Hi SAS users.
I am trying to import the attached text file.
This is what I've written in an attempt to read in the text file:
data test;
infile 'location-of-the-file/test.txt';
input month RM $ Initials $ plan ;
run;
For some reason the plan column is not being read properly. The plan column is supposed to be integer valued.
Could someone advise me what I am doing wrong?
I've never used Linux, thus I'm kind of at a loss to be able to suggest what you might do.
Unlike the file you posted, all of your numbers for the last field appear to end with a letter M.
The only thing I can suggest is to use a input statement (with no variables identified), use the tranwrd function to replace
"M 2" with " 2", and then grab the 4 fields from _infile_
Hopefully, someone who has worked with Linux can assist you better than I can.
Hi,
I ran your code. No problem for me:
data test;
infile 'C:\temp\forum\test.txt';
input month RM $ Initials $ plan ;
run;
proc print;run;
Obs month RM Initials plan
1 2013 Kenny KJG 1227466
2 2013 Sarah SYY 810013
3 2013 Ryan RSK 994884
4 2013 Vinday VXC 855295
5 2013 Marie MXM 1412827
6 2013 George GWL 1119429
7 2013 Chris CXD 1205086
8 2013 Total (ALL) 7625000
Appears to read in perfectly, for me, using your code. What kind of result are you getting?
Hi all.
Thanks for your replies.
This is what I get:
month RM Initials plan
2013 Kenny KJG .
2013 Sarah SYY .
2013 Ryan RSK .
2013 Vinday VXC .
2013 Marie MXM .
2013 George GWL .
2013 Chris CXD .
2013 Total (ALL) 7625000
Hmm this is weird..
What kind of system are you on? Which version of SAS are you using? Can you post the actual code that you ran?
I am using SAS EG 4.1(4.1.0.1020) - a bit old school?
under Windows XP
%put &sysscp
returns LINUX.
I've attached the log I get.
Thanks
I've never used Linux, thus I'm kind of at a loss to be able to suggest what you might do.
Unlike the file you posted, all of your numbers for the last field appear to end with a letter M.
The only thing I can suggest is to use a input statement (with no variables identified), use the tranwrd function to replace
"M 2" with " 2", and then grab the 4 fields from _infile_
Hopefully, someone who has worked with Linux can assist you better than I can.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.