The SAS Output Delivery System and reporting techniques

PROC FORMAT percentages aren't showing correctly

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 18
Accepted Solution

PROC FORMAT percentages aren't showing correctly

[ Edited ]

Hi, 

 

I need help.  I'm trying to output the following:

 

 

Female

Total N

N

%

Class A

1695

895

(52.8%)

Class B

2125

1334

(62.8%)

Total

3820

2229

(58.4%)

 

But I got below instead.  The percentages aren't showing up correctly:

 

 

Female

Total N

Sum

Mean

Class A

1695

895

(0.5%)

Class B

2125

1334

(0.6%)

Total

3820

2229

(0.6%)

 

 Thanks so much!

 

My code:

proc format;
picture paren (round)
 low-high = '(009.9%)'
 ( prefix = '(' );
run;

proc tabulate data=data  FORMAT=9.0 order=formatted;
var FEMALE;
table class_grp ='' ALL = 'Total' * {style={bordertopcolor=black bordertopwidth=1 bordertopstyle=double font_weight=bold}}, 
ALL = 'Total N' * n

(FEMALE) * (sum mean * f=paren.)
/ ROW=FLOAT RTS=22 MISSTEXT='-' ;
KEYWORD all / style=[bordertopcolor=black bordertopwidth=1 bordertopstyle=double font_weight=bold fontstyle=italic];
title1;
run;

 

 

 

Thanks so much!

 


Accepted Solutions
Solution
‎09-26-2017 10:53 AM
Super User
Posts: 12,996

Re: PROC FORMAT percentages aren't showing correctly

If you are taking the mean of 1/0 coded variable to create percentages then the values are likely to be between 0 and 1. Which will likey require to use a multiplier in the format to get the range into the range of the picture

 

Try

picture paren (round)

low-high = '(009.9%)'

( prefix = '(' mult=1000);

 

 

Since you haven't provided any actual data the value for mult is guess.

View solution in original post


All Replies
Trusted Advisor
Posts: 1,270

Re: PROC FORMAT percentages aren't showing correctly

 

Hi,

 

Please try this:

 

proc format;
picture paren 
low-high='009.00%';
picture paren low-high=99.99 (prefix='(' mult=1);
run;

Solution
‎09-26-2017 10:53 AM
Super User
Posts: 12,996

Re: PROC FORMAT percentages aren't showing correctly

If you are taking the mean of 1/0 coded variable to create percentages then the values are likely to be between 0 and 1. Which will likey require to use a multiplier in the format to get the range into the range of the picture

 

Try

picture paren (round)

low-high = '(009.9%)'

( prefix = '(' mult=1000);

 

 

Since you haven't provided any actual data the value for mult is guess.

Occasional Contributor
Posts: 18

Re: PROC FORMAT percentages aren't showing correctly

This worked perfectly for me.  Thanks so much!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

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