BookmarkSubscribeRSS Feed
johnsonemilyk
Fluorite | Level 6

I'm wondering if there's a way to automatically filter output that doesn't meet user-determined suppression rules. I would like to find a way to automatically censor data with fewer than six unweighted responses and/or a relative standard error of 30 percent or more.

 

For example, in the procedure below -- let's say there are only three men below the poverty line in my unweighted sample. I would like to then exclude that value from the table.

 

PROC SURVEYFREQ DATA=mydata;
TABLE gender*income / ROW CL CHISQ;
WEIGHT pop_weight; STRATA region;
TITLE "Analysis of Gender and Income";
RUN;

 

Thanks!

3 REPLIES 3
Reeza
Super User

You can build a custom formats that shows those values as *****?

 

It depends on what you mean by 'filter', would that mean exclude entirely or mask?

 


@johnsonemilyk wrote:

I'm wondering if there's a way to automatically filter output that doesn't meet user-determined suppression rules. I would like to find a way to automatically censor data with fewer than six unweighted responses and/or a relative standard error of 30 percent or more.

 

For example, in the procedure below -- let's say there are only three men below the poverty line in my unweighted sample. I would like to then exclude that value from the table.

 

PROC SURVEYFREQ DATA=mydata;
TABLE gender*income / ROW CL CHISQ;
WEIGHT pop_weight; STRATA region;
TITLE "Analysis of Gender and Income";
RUN;

 

Thanks!


 

johnsonemilyk
Fluorite | Level 6

Thanks Reeza! A custom format may work. Either excluding entirely or masking should function, though. I'll see about doing a custom format.

ballardw
Super User

Send the desired output to a dataset using the ODS OUTPUT statement.

 

PROC SURVEYFREQ DATA=mydata;
TABLE gender*income / ROW CL CHISQ;

ods output chisq =gender_income_chi;

ods output crosstabs= gender_income_cross;
WEIGHT pop_weight; STRATA region;
TITLE "Analysis of Gender and Income";
RUN;

 

Would send the results of the CHISQ test to a dataset named gender_income_chi and the counts and such from the crosstab to a set gender_income_cross.

 

Then use any of the reporting procedures and options to display, subset or manipulated the data in the dataset as desired.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2342 views
  • 3 likes
  • 3 in conversation