BookmarkSubscribeRSS Feed
bucky032
Calcite | Level 5
I am trying to compare proportion of groups with MADV=1 or MADV=2 meeting an outcome (TEETHGUM_DICH=1). I want to do this separately for age groups (AGE_DICH), which is why I've set this up as a three-way comparison. However, I can't figure out how to code this to get a chi-sq test between (TEETHGUM_DICH=1 + MADV=1)  and (TEETHGUM_DICH=1 and MADV=2). I want to use ODS to shape the output so getting that ChiSq output in the same row would be really helpful. 
 
Code I am using, with a photo of output and the desired numbers to test between. Please let me know if you have any advice -- thanks!
 
proc surveyfreq data=dental_final method=brr(fay=0.3);
title 'Weighted / Unweighted n';
weight ER_EEYRSWGT;
repweight ER_EEYRS1--ER_EEYRS100;
table age_dich*madv*teethgum_dich / chisq;
where ER_EEYRSWGT NE .;
run;
 
sas_example.PNG
7 REPLIES 7
ballardw
Super User

I am a bit confused by  this part of your want: "chi-sq test between (TEETHGUM_DICH=1 + MADV=1) and (TEETHGUM_DICH=1 and MADV=0)."

 

Your output does not show any value of MADV=0.

 

Chi-sqr is basically a test of distribution. When you have var1*var2 the chi-sqr statistic reports basically are the observed counts close to the expected (not a significant difference) or not (significant difference) based on the row and column total counts.

So there is no "this point vs that point" with chi-sq.

 

To get the crosstab output into a data set use: ods output crosstabs= mycrosstabdataset;

To get the Chi-sqr results into a data set use: ods output chisqr= mychisqrdataset;

or which ever libname.data set you want instead of the mycrosstabdataset.

bucky032
Calcite | Level 5

Sorry, I meant MADV=1 vs MADV=2. 

bucky032
Calcite | Level 5

I may be using 'chi sq' incorrectly, but I want to test the difference between proportions of MADV=1 and MADV=2 populations meeting the TEETHGUM_DICH outcome.

bucky032
Calcite | Level 5

This is a better representation of what I am trying to test -- based on the frequencies, is there a significant difference between MADV=1 and MADV=2 in the proportion of people meeting TEETHGUM_DICH=1? sas_example_2.PNG

PaigeMiller
Diamond | Level 26

I believe that PROC SURVEYLOGISTIC can compare these two percents, using the LSMEANS statement or the SLICE statement.

--
Paige Miller
bucky032
Calcite | Level 5

Hi Paige. Any advice about how to set that up? What statistics am I looking for?

PaigeMiller
Diamond | Level 26

After I posted the comment about SURVEYLOGISTIC, I realized that SURVEYLOGISTIC would compare the LSMEANS (based upon a fitted model) and would not compare the actual means (percents) that you show. So upon further thought, it doesn't seem like SURVEYLOGISTIC is the right tool here. Now maybe you would consider changing your needs and compare the fitted percents, but you haven't said that's what you want.

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 7 replies
  • 1223 views
  • 0 likes
  • 3 in conversation