The following is the raw data set in a txt file , suppose there are two variable , one is named ID, the other is named Name . I want to read the data set , how should I do ? Thank you.
1 Nay Rong
2 Kelly Windsor
3 Julio Meraz
4 Richard Krabill
data ABC;
infile datalines;
input ID
Name&:$15.;
datalines;
1 Nay Rong
2 Kelly Windsor
3 Julio Meraz
4 Richard Krabill
;
run;
proc print data = ABC noobs;
run;
This works for me:
data have;
infile cards;
input ID Name $50.;
cards;
1 Nay Rong
2 Kelly Windsor
3 Julio Meraz
4 Richard Krabill
;;;;
run;
@tianerhu wrote:
The following is the raw data set in a txt file , suppose there are two variable , one is named ID, the other is named Name . I want to read the data set , how should I do ? Thank you.
1 Nay Rong
2 Kelly Windsor
3 Julio Meraz
4 Richard Krabill
Thank you. But it doesn't work.
above is the result.
I have sloved it . Thank you very much.
data ABC;
infile datalines;
input ID
Name&:$15.;
datalines;
1 Nay Rong
2 Kelly Windsor
3 Julio Meraz
4 Richard Krabill
;
run;
proc print data = ABC noobs;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.