I need to read a large dataset, infile from *.dat
I set irecl=32767 the maxim value
the log showed
The minimum record length was 20000.
The maximum record length was 20000.
and for the date, the log showed a warning
"has already been defined as numeric"
Any advice how to change irecl to the right value?
Show log (with relevant code). LRECL is not the reason for the WARNING.
you are right.
I find sas stops before the varible "date", so I format the date, then there is a warning
it seems not necessary to format
all are charcters, no delimiters, a lot of space, so I have all the code with the location and length of the variables
INFILE 'c:\abc.DAT' truncover lrecl=30000
obs=300;
INPUT
@59 id $1. @139 fname4 $4. ..
@11593 cdc $8.;
Run;
I adjusted irecl from 20000 to the maxim, the record is 20000
but it dos not read right for the rest part
This is not the log, just part of the code.
To help you, we need the whole log of the data step including the ERROR message.
see my log below, please
To repeat myself:
To help you, we need the whole log of the data step including the ERROR message.
Whole log means "including the code that caused the ERROR".
Just copy/paste from the log; it's not rocket science.
so your code reads:
format DATE date9.;
input .... DATE $8. .... ;
Well the error is exactly was it says: you have defined the variable as numeric (with the format statement) and then you want to read it as a string.
Formatting the date will not force reading its value. You have to look at where in the record the reading stops and why. One way to do it is
infile ... lrecl=30000 pad truncover;
input X $30000.;
and then use substr() to analyse the contents of X (use _infile_ instead of X if you know about _infile_, otherwise just use the X variable to do your investigation).
Thanks
I tried yours. it does not change, still it cant not read the rest part
5 records were read from the infile
' c:\abc.DAT'.
The minimum record length was 20000.
The maximum record length was 20000.
NOTE: The data set WORK.CONTEST has 5 observations and 213 variables.
NOTE: DATA statement used (Total process time):
real time 0.17 seconds
cpu time 0.07 seconds
1) How long is your text file record length? At least 20k it seems; try using lrecl=32767
2) What's the position of the date in the record?
I do not understand that, "What's the position of the date in the record?"
I have adjusted the value of lrecl, with many different values, it did not work
"What's the position of the date in the record?" means: how many characters do you have to count on your text input record before the date is found?
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.