data work.homework;
infile datalines dsd;
input name $
age
height;
datalines;
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
;
proc print data = work.homework;
run;
The main thing is you need to fix the data so that it can be parsed.
Either use a delimiter other than space between the values on the lines. Your current code is expecting a comma as the delimiter as that is the default when the DSD option is used.
data homework;
infile datalines dsd;
input name :$30. age height;
datalines;
John McCloskey,35,71
June Rosesette,10,43
TinekeJones,9,37
;
Or insure there are at least two spaces after the name (and no more than one space in a row in the name) so you can use the & modifier.
data homework;
input name &:$30. age height;
datalines;
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
;
this program above does not work. Please give me a help.
If you have two spaces after the name, and you use the & to read in the names, then everything will work.
https://www.geeksforgeeks.org/sas-how-to-read-character-using-ampersand/
The main thing is you need to fix the data so that it can be parsed.
Either use a delimiter other than space between the values on the lines. Your current code is expecting a comma as the delimiter as that is the default when the DSD option is used.
data homework;
infile datalines dsd;
input name :$30. age height;
datalines;
John McCloskey,35,71
June Rosesette,10,43
TinekeJones,9,37
;
Or insure there are at least two spaces after the name (and no more than one space in a row in the name) so you can use the & modifier.
data homework;
input name &:$30. age height;
datalines;
John McCloskey 35 71
June Rosesette 10 43
TinekeJones 9 37
;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.