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

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!

 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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

3 REPLIES 3
stat_sas
Ammonite | Level 13

 

Hi,

 

Please try this:

 

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

ballardw
Super User

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.

lin39
Obsidian | Level 7

This worked perfectly for me.  Thanks so much!

sas-innovate-2024.png

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.

 

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.

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
  • 3 replies
  • 1022 views
  • 2 likes
  • 3 in conversation