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

I'm trying to format the mean as a percentage. this is the code I used:

proc means data=omrswork;
where count_carf1 >0 and count_carf2=0 and count_carf3=0 and count_carf4=0 and dc_fiscal_year=2 and dc_fiscal_year^=99 and percent_nscx^=.;
var percent_nscx;
format dc_fiscal_year fiscalyear. percent_nscx percent8.2 site site.;
run; 

How come the percent.8.2 format isn't working for the actual mean that is calculated?

 

When I run the proc means, the mean is still in decimal form.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Christina,

 

This is a topic that has tripped up many people.  Here is the combination of factors at work:

 

  • The format is being applied to the variable PERCENT_NSCX.
  • PROC MEANS doesn't print PERCENT_NSCX.

Since PROC MEANS is calculating statistics, and printing the statistics (not the original variable), the format is ignored.

 

Theoretically, you could ask PROC MEANS to create an output data set.  Then print the output data set while adding a FORMAT statement.

View solution in original post

2 REPLIES 2
Astounding
PROC Star

Christina,

 

This is a topic that has tripped up many people.  Here is the combination of factors at work:

 

  • The format is being applied to the variable PERCENT_NSCX.
  • PROC MEANS doesn't print PERCENT_NSCX.

Since PROC MEANS is calculating statistics, and printing the statistics (not the original variable), the format is ignored.

 

Theoretically, you could ask PROC MEANS to create an output data set.  Then print the output data set while adding a FORMAT statement.

christinagting0
Quartz | Level 8

Thanks Astounding! this is helpul to know:)

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 2645 views
  • 2 likes
  • 2 in conversation