BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wutao9999
Obsidian | Level 7

For the data in the attached file, I used the below code to repull the data.  However, the data has been cut off in the middle because the data in a row is too long.  Is there a way to set some number such that the data is not cut off?  Thank you for the help.

 

data want ;

length filename fn $200 ;

infile 'C:\Users\*.txt' filename=fn eov=eov length=ll column=cc truncover ;

fileno+1;

do row=1 by 1 until (eov) ;

do col=1 by 1 until (cc>ll);

input num @ ;

filename=fn ;

output;

end;

input;

end;

run;

1 ACCEPTED SOLUTION
3 REPLIES 3
PGStats
Opal | Level 21

Note: The default LRECL under Windows was increased in SAS 9.4 to 32767 . OP is probably running an earlier version where the default LRECL under Windows was 256.

 

http://support.sas.com/documentation/cdl/en/hostwin/63047/HTML/default/viewer.htm#chifoptfmain.htm

PG
PGStats
Opal | Level 21

... Also, the eov variable is set to 1 after you read a line from the next file and it is not reset by SAS. Try this logic:

 

data test;
length fn filename $200;
infile "C:\users\*.txt" filename=fn eov=eov 
    length=ll column=cc truncover lrecl=2000;
input @; /* Read a line to trigger eov */
if eov then do;
    fileno + 1;
    row = 0;
    eov = 0; /* reset eov */
    end;
row + 1;
filename = fn;
do col = 1 by 1 until(cc>ll);
    input num @;
    output;
    end;
run;
PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 3732 views
  • 0 likes
  • 3 in conversation