BookmarkSubscribeRSS Feed
BeeB
Calcite | Level 5

I am creating a bunch of tables using proc tabulate, but due to the privacy of the individuals who have answered my survey, I need to mask any cell with an N of only 5 or less than 5. I have managed to mask the N, but not the corresponding percentages. Is it possible to do so using proc tabulate? If it is, how do I do this correctly?

 

I have used the following code:

Proc format;
	value hide
		1-5= "*"
		other = [comma8.];
run;

Proc tabulate data=have;
class year gender quest1;
table  (gender="")*(rowpctn N*F=hide.), year*(quest1="");
run; 

 

And this is my current output (I have made up the data):

                           2014
  YesNoMaybeTotal
BoyN40**50
PctN80%10%10%100%
GirlN2525050
PctN50%50%0%100%

 

I want sas to also mask the cells showing that 10 % of the boys have answered no/maybe. Is this possible? 

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:
In order to help you, people have to do these things:
1) make some fake data
2) guess what your ODS destination is (you don't show any ODS statements) or indicate whether you want PDF, RTF or HTML output

In order to help us help you, it's good to have your code, but no one can run your code without data.

Without data, the only thing I can guess is that just as you are doing N*F=hide. for the N statistic (and it ONLY applies to the N statistic). You need to have a different format for percent.

There's something odd about your made up data, and I assume those are made up results too, because TABULATE does not automatically provide a percent sign for percents. So the question is, how are you getting those % signs in the output. You should need a picture format to generate them. Also curious is how you are getting a label of "PctN" when the statistic you're asking for is "rowpctn" -- by default, TABULATE would use the statistic name as the label. Also, I am curious how you got the Total on the far left. When I make some fake data from SASHELP.CLASS and use your code (without the format), this is what I get:
yes_no_maybe.png

Note how RowPctN is above the N statistic. Note also how there is not a TOTAL column. And, there are NOT any percent signs by default. So having your data or some fake data and ALL your code  showing how you got % and the Total and how the N row got listed first -- would be useful.
Cynthia

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 1074 views
  • 0 likes
  • 2 in conversation