BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Onyx | Level 15

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;
1 ACCEPTED SOLUTION

Accepted Solutions
PeterClemmensen
Tourmaline | Level 20

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;

 

View solution in original post

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

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;

 

ChrisNZ
Tourmaline | Level 20

This works:

input  score Model $ obligation PCT_obligation percent.;

 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1304 views
  • 2 likes
  • 3 in conversation