SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

problem infile statement

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

problem infile statement

[ Edited ]

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


Accepted Solutions
Solution
‎10-11-2016 04:44 AM
Super User
Posts: 17,912

Re: problem infile statement

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


All Replies
Solution
‎10-11-2016 04:44 AM
Super User
Posts: 17,912

Re: problem infile statement

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. 

New Contributor
Posts: 2

Re: problem infile statement

Thank you, Reeza. 

"LRECL =1000" works.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 372 views
  • 2 likes
  • 2 in conversation