BookmarkSubscribeRSS Feed
bazingarollcall
Fluorite | Level 6

Hello, 

I am trying to assess the relationship between calculated mean scores of grouped survey questions (continuous variable) and various categorical demographic variables. 

 

I performed a chi square test between the mean of grouped survey questions and a categorical age variable. Is it correct to include the frequency of each observation in the table while calculating the chi square, even though I am weighting by means? 

 

Code: 

 

proc summary data=formatting mean std n noprint;
class agec;
var mean_func ;
var mean_sc ;
var mean_acc ;
var mean_qa ;
var mean_out ;
var mean_part ;
var mean_sat ;
var mean_qol;

output out=b1_stats;
output out=mean1 mean=;
run;



data b1_stats2;
format _STAT_ $30.;
set b1_stats;
run;

proc sort data=b1_stats2
out=b1_stats;
by agec _TYPE_ _stat_;
run;

proc transpose data=b1_stats out=b1_han;
by agec _TYPE_;
id _stat_;
run;


data b1_table /*(keep= _TYPE_ _STAT_ Adult_Survey_Results Responses)*/;
format Adult_Survey_Results $40.;

set b1_han;
if _NAME_ = 'mean_acc' then Adult_Survey_Results= 1 ;
else if _NAME_= 'mean_qa' then Adult_Survey_Results= 2;
else if _NAME_= 'mean_func' then Adult_Survey_Results=7;
else if _NAME_= 'mean_sat' then Adult_Survey_Results=5 ;
else if _NAME_= 'mean_out' then Adult_Survey_Results= 3;
else if _NAME_= 'mean_sc' then Adult_Survey_Results= 6 ;
else if _NAME_= 'mean_part' then Adult_Survey_Results= 4;
else if _NAME_= 'mean_qol' then Adult_Survey_Results= 8 ;

Responses=N;
STD1=STD;
run;



proc freq data=b1_table;
tables agec*Adult_Survey_Results / list chisq;
where agec not in (99);
weight mean;
run;

 

 

Frequency report without frequency:

bazingarollcall_0-1635532666794.png

 

 

Frequency report with frequency:

 

bazingarollcall_1-1635532759301.png

 

 

Why is the p value 1 when the frequency is not included? 

 

 

Thanks in advance!

3 REPLIES 3
Reeza
Super User
Out of curiousity, why did you come back to Chi Square? From what I recall from your last posts, wasn't T-test going to be more appropriate here? From your descriptions of the data, ANOVA seems the correct approach.
bazingarollcall
Fluorite | Level 6

The directions I was given say to "Run the appropriate statistics either chisq or mean scores with significance test", so I tried not to overthink it. 

 

Thank you for your input about ANOVA, I've been switching back and forth on what to use. 

Reeza
Super User
If you're looking to compare the distribution of the scores between the groups then you'd run a proc freq and chi square test to see if the distribution was different. For survey data this is typical but requires count data not means.
You can test if the means are different across a set of scores by groups to see if they differ..but it's a different test with a different hypothesis.
ANOVA or T-Test requires means.
Pick one and go with it, but right now it seems like you're mixing them.


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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 615 views
  • 1 like
  • 2 in conversation