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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 3723 views
  • 0 likes
  • 3 in conversation