## How come the percent format isn't working for proc means?

Solved
Frequent Contributor
Posts: 88

# How come the percent format isn't working for proc means?

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.

Accepted Solutions
Solution
‎08-31-2016 01:23 PM
Super User
Posts: 5,717

## Re: How come the percent format isn't working for proc means?

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.

All Replies
Solution
‎08-31-2016 01:23 PM
Super User
Posts: 5,717

## Re: How come the percent format isn't working for proc means?

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.

Frequent Contributor
Posts: 88