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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 4174 views
  • 0 likes
  • 3 in conversation