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