09-27-2011 11:43 PM
I am trying to import data in sas like:
A B C D E
x y z h i
s1 s2 s3 s4 s5
where A B C D and E are column names.
I have 240 columns in my dataset and the code I am using is:
infile Attdata notab dlm='09'x dsd missover LRECL = 100000000;
length A B...........E $200;
input A B.....E;
Whenever I import data some of the rows of column B, C etc gets stacked below rows of A like:
A B C D E
x h i
s1 s2 s3 s5
Is there a way to fix this? Do i need to do something with lrecl one?
Thanks for your time.
09-27-2011 11:58 PM
I've never confronted the type of problem you are describing. I don't think the overly large lrecl will hurt anything, but you probably should set it to be closer to what your data actually use. Since you only have 256 $200 character fields, I would presume that somewhere between 60000 to 100000 should be more than sufficient.
Why are you including the notab option in your infile statement? That is typically only used when incorporating dde and that doesn't appear to be the case.
If removing the notab option doesn't end up correcting the situation, there is always the possibility that your data simply wasn't prepared correctly in the first place.
09-28-2011 08:34 AM
Actually, I think can be an issue with the large LRECL on some platforms. I would suggest that you reduce the LRECL to 32767 at the maximum (this is 2**15 -1). My only justification for this is that this is the system limit for z/OS mainframe systems and I have always been told that this is the maximum LRECL that can be used.
09-28-2011 08:50 AM
I don't disagree, but then the informat would also have to be changed and that may not be possible. The OP indicated having 240 $200 length columns. However, you do raise a good point, as I don't think that the value itself can be larger than 32,767, but can have a suffix of either no suffix, k, m, g or t.
09-28-2011 09:05 AM
32767 is the limit of LRECL only if you want to use the automatic variable _INFILE_. Can't have a variable larger than that. On windows I think the limit is 1 million or so for lrecl.
The program the OP posted is probably not the real program so trying to figure out the real problem will be very difficult, impossible.
09-28-2011 09:13 AM
There seems to be some conflicting data on this.... The INFILE documentation says that the LRECL is dependent on the operating system, while the SYSTEM OPTION documentation says the maximum is 32,767.
09-28-2011 09:18 AM
There appear to be a number of conflicting statements regarding lrecl in the documentation. e.g.,
The current upper limit for Logical Record Length (LRECL) when reading and writing external files on the MS Windows platforms is 1 megabyte. The upper limit will be raised to 1 gigabyte with SAS 9.2.