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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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