BookmarkSubscribeRSS Feed
Nupur20
Calcite | Level 5

Hi,

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:

data INFO;

          infile Attdata notab dlm='09'x dsd missover LRECL = 100000000;

          length A B...........E $200;

input A B.....E;

run;

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

y    s4

z

Is there a way to fix this? Do i need to do something with lrecl one?

Thanks for your time.

7 REPLIES 7
art297
Opal | Level 21

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.

OS2Rules
Obsidian | Level 7

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. 

art297
Opal | Level 21

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.

data_null__
Jade | Level 19

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.

OS2Rules
Obsidian | Level 7

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. 

art297
Opal | Level 21

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.

data_null__
Jade | Level 19

The system option is for DEFAULT lrecl.  And as stated has a limit of 32K.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 7 replies
  • 1288 views
  • 0 likes
  • 4 in conversation