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.;
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.