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!
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.
Hi,
Please try this:
proc format;
picture paren
low-high='009.00%';
picture paren low-high=99.99 (prefix='(' mult=1);
run;
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.
This worked perfectly for me. Thanks so much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.