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

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

 

Ready to join fellow brilliant minds for the SAS Hackathon?

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

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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