BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
ZeeM_31
Fluorite | Level 6

Hello all,

I'm working with national survey data that ask people if they have participated in a cancer screening program, something like - "Have You Ever Taken the Cancer Test?" - Yes/No.

I have two different years of the survey, 2010 & 2015 and have calculated the proportion of people who answered Yes for all the Provinces, for both survey year, but I'd also like to test if there's significant difference in the proportion of people who have screened in 2010 vs 2015

 

Here's the data and what I have tried: 

 

data screen_rates;
input Year $ Province $ Screen $ count;
datalines;
cchs2010 A Yes 54
cchs2010 A No 46
cchs2010 B Yes 53
cchs2010 B No 47
cchs2010 C Yes 55
cchs2010 C No 45
cchs2010 D Yes 54
cchs2010 D No 46
cchs2017 A Yes 48
cchs2017 A No 52
cchs2017 B Yes 43
cchs2017 B No 57
cchs2017 C Yes 51
cchs2017 C No 49
cchs2017 D Yes 49
cchs2017 D No 51
;
run;

 

proc freq data= screen_rates;
tables Year*Province*Screen /chisq riskdiff;
weight Count;
run;

 

But I saw this message in the log: RISKDIFF statistics are computed only for 2x2 tables.

 

I think there should be a way to test the proportions for each province in 2010 vs 2015 for significance, but nothing has worked for me thus far. I appreciate suggestions and ideas. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

It sounds like you want to perform independent analyses for each Province. If so, sort by Province and perform a BY-group analysis:

data screen_rates;
input Year $ Province $ Screen $ count;
datalines;
cchs2010 A Yes 54
cchs2010 A No 46
cchs2010 B Yes 53
cchs2010 B No 47
cchs2010 C Yes 55
cchs2010 C No 45
cchs2010 D Yes 54
cchs2010 D No 46
cchs2017 A Yes 48
cchs2017 A No 52
cchs2017 B Yes 43
cchs2017 B No 57
cchs2017 C Yes 51
cchs2017 C No 49
cchs2017 D Yes 49
cchs2017 D No 51
;
 
proc sort data=screen_rates;
   by Province Year;
run;

proc freq data= screen_rates;
   by Province;
   tables Year*Screen /chisq riskdiff;
   weight Count;
run;

View solution in original post

4 REPLIES 4
Rick_SAS
SAS Super FREQ

It sounds like you want to perform independent analyses for each Province. If so, sort by Province and perform a BY-group analysis:

data screen_rates;
input Year $ Province $ Screen $ count;
datalines;
cchs2010 A Yes 54
cchs2010 A No 46
cchs2010 B Yes 53
cchs2010 B No 47
cchs2010 C Yes 55
cchs2010 C No 45
cchs2010 D Yes 54
cchs2010 D No 46
cchs2017 A Yes 48
cchs2017 A No 52
cchs2017 B Yes 43
cchs2017 B No 57
cchs2017 C Yes 51
cchs2017 C No 49
cchs2017 D Yes 49
cchs2017 D No 51
;
 
proc sort data=screen_rates;
   by Province Year;
run;

proc freq data= screen_rates;
   by Province;
   tables Year*Screen /chisq riskdiff;
   weight Count;
run;
ZeeM_31
Fluorite | Level 6
Thank you, Rick!
That worked! As this is large survey data, I have avoided doing By-group analyses and have only used survey procedures - surveyfreq etc, so somehow, I forgot this was an option 🙂
Thanks again!
Watts
SAS Employee

Your TABLES request, Year*Province*Screen, produces a table of Province*Screen (a 4x2 table) for each level of Year. But it sounds like you actually want a 2x2 table of Year*Screen for each Province. In that case, an alternative (to using a BY statement) is to specify the multiway table as 

TABLES Province * Year * Screen / chisq riskdiff;

For RISKDIFF, this is equivalent to specifying Province in a BY statement. But specifying the multiway table form allows you to compute stratified statistics (like COMMONRISKDIFF) if you need that. 

ZeeM_31
Fluorite | Level 6

Thank you, Watts

This was very helpful!

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!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 603 views
  • 3 likes
  • 3 in conversation