comp.soft-sys.sas - The SAS statistics package.
Sorry, it should be: infile (NOT file) option LRECL will work for Ajay. ============ Kind Regards, Zibao Zhang, MD ----- Original Message ----- From: "Zibao Zhang" < XXXX@XXXXX.COM > To: "_SAS-L_" < XXXX@XXXXX.COM >; "Ajay" < XXXX@XXXXX.COM > Sent: Monday, September 08, 2003 8:32 AM Subject: Re: problem with more than 255 columns when importing from text file to SAS > Ajay, > > file option LRECL will work. The following is a sample code. > > ============ > Kind Regards, > Zibao Zhang, MD > > > filename in 'f:\temp\in.txt'; > *********************************************************; > * Create a .txt file to demo, Hope this file is similar to your data. ; > > data _null_; > file in lrecl=100000; /* USING LRECL, the default is 256!!! > this is the problem you met > you can set a number larger than that > of you data*/ > array varlist(*) var1-var1000; > do i =1 to 100; > do j = 1 to 1000; > varlist(j) =int(uniform(123)*10000); > end; > put var1 -var1000; > end; > run; > > *********************************************************; > data test; > infile in lrecl=100000 truncover; /* USING LRECL, the default is 256!!! > TRUNCOVER is a good option to read > raw data, please ref to the manual*/ > input var1-var1000; > run; > > > > ----- Original Message ----- > From: "Ajay" < XXXX@XXXXX.COM > > Newsgroups: bit.listserv.sas-l > To: < XXXX@XXXXX.COM > > Sent: Monday, September 08, 2003 3:00 AM > Subject: problem with more than 255 columns when importing from text file to SAS > > > > I have SAS Enterprise guide 1.3 on Windows XP. I am trying to import > > some data in a comma separated text file into SAS. > > > > The text file has more than 255 columns, more than 800 in fact. When I > > try to import this into SAS, it reads only upto 255 columns and then > > stops. > > > > Can someone please help me with this? How do I import more than 255 > > columns? > > > > Thanks in advance > > Ajay > > >
You are working with version 8 because version SAS 9 support 32k of Excel's cell width. I think is no another way to read data from MSExcel than use .CSV and column's metadata. On 06/04/06, Jim Groeneveld < XXXX@XXXXX.COM > wrote: > > Hi friends, > > Are you there? It is so quiet at SAS-L! Let's throw in a problem: > > I am reading an Excel file with at least one cell (of column Language) > with > more than 255 characters (probably around 750 characters). But I get only > the first 255 of them. My code is: > > PROC IMPORT OUT=3DTranslations (KEEP=3DVariable Language) > DATAFILE=3D "D:\Projects\[.........]\DATA\Translations.xls" > DBMS=3DEXCEL REPLACE; > SHEET=3D"Sheet1$"; > GETNAMES=3DYES; > MIXED=3DNO; > SCANTEXT=3DYES; > TEXTSIZE=3D1024; > USEDATE=3DYES; > SCANTIME=3DYES; > INFORMAT Language $1024.; FORMAT Language $1024.; > RUN; > > PROC CONTENTS says the format and informat of Language both are $1024. Bu= t > it also says its length (Len) is 255. I have googled the internet (of > course) and the SAS-L archives, but found nothing useful yet. How to I > increase this length? > > Regards - Jim. > -- > Jim Groeneveld, Netherlands > Statistician, SAS consultant > home.hccnet.nl/jim.groeneveld >
Hi. I need to read in a sizable volume of pipe-delimited text files. Using some code adapted from "Reading a Pipe-Delimited File with in a Comma-Delimited File" (Carey Smoak), my plan is to read the file names from the directory, put the file names into separate macrovariables, and use proc import inside a do loop (copied below). I opted for the simple proc import because the files are not standard (different combinations of column, but all have a common denominator of columns I need). I want this to be as automated and maintenance-free as possible since this will be a repeated process completed by others. However, I am running into an error with some files. One of the columns I am reading has a text description, and in some cases it is very long. When a long description appears in the first row of data (or the first 20 I gather), proc import guesses an informat/format that is unknown to SAS (see error below). A past posting (Howard Schreier, Dec 26, 2002) suggested block copying the data step code generated in the log by proc import, fixing the error, and then re-running the data step code. I tried this and it works. However, I would like something more efficient since I am dealing with thousands of files. Any ideas how to code around this problem? Or, any ideas ideas how to uniformly identify when this error occurs to speed up the manual fix process? Thanks. Jack /* Import Code %macro importras; %do i = 1 %to &filecount; PROC IMPORT OUT= data.&&fileb&i DATAFILE= "&datalocation2.&&file&i...txt" DBMS=DLM REPLACE; Delimiter = "|"; getnames = yes; RUN; %end; %mend; /* Error 130 informat SDR_DESCRIPTION_TEXT $12E3. ; ----- 228 22 - 200 ERROR 228-185: Informat 12E3 is unknown. ERROR 22-322: Syntax error, expecting one of the following: a name, -, ;, DEFAULT, _ALL_, _CHARACTER_, _CHAR_, _NUMERIC_. ERROR 200-322: The symbol is not recognized and will be ignored.
Do you have an example. I think SAS is limited by the excel limit of 32,000 (something) records. You may have to split the excel or create different sheets. On 5/16/08, Irin later < XXXX@XXXXX.COM > wrote: > > My text tilde delimited source files are too huge to import them to > Excel 2002 in order to import then to SAS 9. On the other hand they have > data to be fixed and Access rejects part of them. > > I am trying to find a way for importing these text tilde delimited files > directly into SAS 9. > > Could you please help me with a code? > > > > Thank you in advance! > > > > Irin > >