BookmarkSubscribeRSS Feed
weiwei2392
Fluorite | Level 6

when i am trying to import this data into SAS.

324036.jpg

i use the following code, however......

 

data Conference;
length eat $24.;
infile 'C:\Users\user\Dropbox\SAS\SASDATA\Conference.dat' missover;
input attendee $1-20 business $21-41 attendeeID 42-46 phone1 $47-60 phone2 $61-74 phone3 $75-88
registered $89-92 contacthome $93-96 contactmobile $97-100 @101 registrationrate
Wednesday $105-108 Thursday $109-112 voluntee $113-116 @117 eat ;

run;

 

I got this result ..

 

324041.jpg

only the first word in EAT variable(the first column=the last column in last pic) is read in successfully....

could anyone help me :S    thank you!

1 REPLY 1
Kurt_Bremser
Super User

Try this instead:

data conference;
infile 'C:\Users\user\Dropbox\SAS\SASDATA\Conference.dat' truncover;
input
  attendee $1-20
  business $21-41
  attendeeID 42-46
  phone1 $47-60
  phone2 $61-74
  phone3 $75-88
  registered $89-92
  contacthome $93-96
  contactmobile $97-100
  @101 registrationrate
  Wednesday $105-108
  Thursday $109-112
  voluntee $113-116
  @117 eat $24.
;
run;

Note the truncover option instead of missover, and the use of the $24. format to prevent the interpretation of blanks as delimiters when reading the variable eat.

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1 reply
  • 668 views
  • 1 like
  • 2 in conversation