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.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 665 views
  • 3 likes
  • 3 in conversation