Hello
I am trying to create a raw data sat set with percent values.
Why is it not working please?
Data Output1;
infile datalines truncover;
input score Model $ obligation PCT_obligation ;
format PCT_obligation percent12.1;
cards;
0 a 82.4 2.8%
0 b 447.6 15.4%
2 a 774.8 26.7%
3 a 603.2 20.8%
4 a 461.5 15.9%
5 a 166.2 5.7%
6 a 88.4 3.0%
7 a 87.9 3.0%
8 a 79.9 2.8%
9 a 26.2 0.9%
10 a 16.6 0.6%
11 a 67.4 2.3%
11 b 2.1 0.1%
12 a 443.4 .
12 b 38.3 .
;
run;
Use a Percent. Informat like this
Data Output1;
infile datalines truncover;
input score Model $ obligation PCT_obligation:percent12.1;
format PCT_obligation percent12.1;
cards;
0 a 82.4 2.8%
0 b 447.6 15.4%
2 a 774.8 26.7%
3 a 603.2 20.8%
4 a 461.5 15.9%
5 a 166.2 5.7%
6 a 88.4 3.0%
7 a 87.9 3.0%
8 a 79.9 2.8%
9 a 26.2 0.9%
10 a 16.6 0.6%
11 a 67.4 2.3%
11 b 2.1 0.1%
12 a 443.4 .
12 b 38.3 .
;
run;
Use a Percent. Informat like this
Data Output1;
infile datalines truncover;
input score Model $ obligation PCT_obligation:percent12.1;
format PCT_obligation percent12.1;
cards;
0 a 82.4 2.8%
0 b 447.6 15.4%
2 a 774.8 26.7%
3 a 603.2 20.8%
4 a 461.5 15.9%
5 a 166.2 5.7%
6 a 88.4 3.0%
7 a 87.9 3.0%
8 a 79.9 2.8%
9 a 26.2 0.9%
10 a 16.6 0.6%
11 a 67.4 2.3%
11 b 2.1 0.1%
12 a 443.4 .
12 b 38.3 .
;
run;
This works:
input score Model $ obligation PCT_obligation percent.;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: