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

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

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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. 

View solution in original post

2 REPLIES 2
Reeza
Super User

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. 

landcruiser
Calcite | Level 5

Thank you, Reeza. 

"LRECL =1000" works.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 1455 views
  • 2 likes
  • 2 in conversation