turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- How come the percent format isn't working for proc...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 11:22 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 11:50 AM

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 11:50 AM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

08-31-2016 01:24 PM

Thanks Astounding! this is helpul to know