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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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