I want to create a data set as shown below:
I used the following (column input) code:
data GYM_UPDATE;
infile datalines pad;
input @1 ID @3 Gender $ Age 5-6 Vault 8-10 Floor 12-14 P_BAR 16-18;
datalines;
3 6.7
5 15 8.1 7.2
7 F
;
run;The output is strange:
I am able to create the correct data set by using the listing input with comma as the delimiter. However, I still want to figure out what goes wrong in the above column input code. Thanks in advance.
You miss gender length - how many characters to input.
Try next code:
data GYM_UPDATE;
infile datalines pad;
input @1 ID @3 Gender $1.
Age 5-6 Vault 8-10 Floor 12-14 P_BAR 16-18;
datalines;
3 6.7
5 15 8.1 7.2
7 F
;
run;
You miss gender length - how many characters to input.
Try next code:
data GYM_UPDATE;
infile datalines pad;
input @1 ID @3 Gender $1.
Age 5-6 Vault 8-10 Floor 12-14 P_BAR 16-18;
datalines;
3 6.7
5 15 8.1 7.2
7 F
;
run;
It works, thank you so much!
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 lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.