BookmarkSubscribeRSS Feed
deleted_user
Not applicable
When I try to import the data below, I keep having problems with the last variable VARc
if I specify that the lenght is 3, it only takes the variables that have three digits, if i put 2 it omits the third digit.....any help, Thanks
If I use the wizard import it magically creates a 6th variable with . in them???

(Note: I am a new SAS user. )

here is my code:

data ANY;
infile "E:\ANY.txt" ;
input @1 Date $8. @10 name $5. @16 VARa 3. @20 VARb 3. @24 VARc 2.;
run;

content of the text file

02-02-93 Jason 306 145 97
02-02-93 John 212 132 85
02-09-93 John 215 129 89
02-09-93 Jason 295 142 85
02-09-93 Mary 303 150 102
02-09-93 Beth 323 145 97
02-16-93 Beth 320 149 104
02-16-93 Jason 285 140 87
02-16-93 Mary 999 145 97
02-16-93 John 220 135 93
02-23-93 Mary 307 149 99
02-23-93 John 215 133 92
02-23-93 Beth 319 143 99
2 REPLIES 2
data_null__
Jade | Level 19
I expect you see this message.
[pre]
NOTE: SAS went to a new line when INPUT statement reached past the end of a line.
[/pre]

To fix it use INFILE option TRUNCOVER.

Or switch to list input...

[pre]
filename FT15F001 temp;
data ANY;
*infile "E:\ANY.txt" ;
Infile FT15F001 truncover;
input (Date name VARa VARb VARc)(:mmddyy8. :$5. 3*:3.);
parmcards;
02-02-93 Jason 306 145 97
02-02-93 John 212 132 85
02-09-93 John 215 129 89
02-09-93 Jason 295 142 85
02-09-93 Mary 303 150 102
02-09-93 Beth 323 145 97
02-16-93 Beth 320 149 104
02-16-93 Jason 285 140 87
02-16-93 Mary 999 145 97
02-16-93 John 220 135 93
02-23-93 Mary 307 149 99
02-23-93 John 215 133 92
02-23-93 Beth 319 143 99
;;;;
run;
proc print;
run;
[/pre]
deleted_user
Not applicable
I added the word truncover and it worked.
Thank you so much! I was going nuts.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 739 views
  • 0 likes
  • 2 in conversation