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:
Frequency report with frequency:
Why is the p value 1 when the frequency is not included?
Thanks in advance!
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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.