Hi all,
I am having problem with infile statement. It doesnot read all columns from text file. I have 25 comlums, but only 22 read, the last 3 in sas are missing values .... I have tried several options (truncover, missover....). It just does not work.
my data file (25 comlumns):
1 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 -78.0463 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 -9999.00 -9999.00
2 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 469.880 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 -9999.00 -9999.00
3 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 977.898 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 -9999.00 -9999.00
4 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 -419.711 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 -9999.00 -9999.00
5 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 515.784 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 -9999.00 -9999.00
sas:
data import_all1;
infile "C:\grouping\dat2.txt" truncover;
input var1-var25;
run;
Output (22 variables have values, the rest 3 are just . . .:
1 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 -78.0463 -9999.00 -9999.00 -9999.00 1.00000 . . .
2 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 469.880 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 . . .
3 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 977.898 -9999.00 -9999.00 -9999.00 1.00000 -9999.00 . . .
4 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 -419.711 -9999.00 -9999.00 -9999.00 1.00000 . . .
5 0 0 1 1 -9999 -9999 -9999 -9999 1000001 -9999 -9999 -9999 1 -9999 -9999 -9999 515.784 -9999.00 -9999.00 -9999.00 1.00000 . . .
Please help. Thank you
Any errors in the log?
Try setting LRECL=1000 on your imfile statement, maybe it's currently too short?
Also, examine your text file with an editor that has the option to show invisible characters. See if any are present in your data. Suggestions for Editors are Notepad++ or Textwrangler.
Any errors in the log?
Try setting LRECL=1000 on your imfile statement, maybe it's currently too short?
Also, examine your text file with an editor that has the option to show invisible characters. See if any are present in your data. Suggestions for Editors are Notepad++ or Textwrangler.
Thank you, Reeza.
"LRECL =1000" works.
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.
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.