BookmarkSubscribeRSS Feed
Kadathur970
Calcite | Level 5

data weight_club;

input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;

Loss=StartWeight-EndWeight;

datalines;

1023 David Shaw red 189 165

1049 Amelia Serrano yellow 145 124

1219 Alan Nance red 210 192

1246 Ravi Sinha yellow 194 177

1078 Ashley McKnight red 127 118

run;

3 REPLIES 3
gamotte
Rhodochrosite | Level 12

Name should occupy the positions 6 to 24. Add spaces.

 

data weight_club;
input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight;
Loss=StartWeight-EndWeight;
datalines;
1023 David Shaw         red 189 165
1049 Amelia Serrano     yellow 145 124
1219 Alan Nance         red 210 192
1246 Ravi Sinha         yellow 194 177
1078 Ashley McKnight    red 127 118
;
run;
Kadathur970
Calcite | Level 5

Thank your for the suggestion. I could get dataset table with all the obs and variables.

SuryaKiran
Meteorite | Level 14

The data is not read properly with the code you provided, because you mentioned column 6-24 to read the Name, but actually if you see 6-24 columns data it takes the values other then name.

 

 

data weight_club;

input IdNumber 1-4 Name $ & 20. Team $ StartWeight EndWeight;

Loss=StartWeight-EndWeight;

datalines;

1023 David Shaw red 189 165

1049 Amelia Serrano yellow 145 124

1219 Alan Nance red 210 192

1246 Ravi Sinha yellow 194 177

1078 Ashley McKnight red 127 118

run;  

 

Make sure the space between the data is two blanks other then between names. i.e space between 1023 and David is two blanks and space between David and shaw is one blank only. "&" here is used to treat the name seperated by single blank as one whole name.

Thanks,
Suryakiran

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
  • 3 replies
  • 775 views
  • 0 likes
  • 3 in conversation