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!
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.