I am new to analyzing survey data so would very much appreciate some help!
I'm working with survey data (SAS 9.4) that is in three different SAS data sets. The data sets are from when the survey was administered in 2012, 2015, and 2018 to different schools. One of the schools wants to look at trends in the data for students at their school for certain questions. I want to know how to calculate whether the change in responses to these questions are statistically significant from year to year. For example, I have one question (the variable is q43) that has four different response options:
1=Strongly agree
2=Agree
3=Disagree
4=Strongly disagree
To get the freq table for one year my code looks like this:
proc surveyfreq data=2015dataset;
tables q43 / row cl cv;
where District=15;
weight Weight;
run;
How can I calculate whether the change in response to this question differs significantly by year? Also, the data sets are weighted, but every student took the survey at this particular high school so they all have a weight of 1.
A good first step would be to combine all 3 years into 1 dataset. You could do this using the (in=) dataset option.
data all_years;
set survey2012(in=s12) survey2015(in=s15) survey2018(in=s18);
if s12 then year = 2012;
if s15 then year = 2015;
if s18 then year = 2018;
run;
Because you have discrete responses (1, 2, 3, or 4), comparing the medians of the groups rather than means might be a good option. A Kruskal Wallis test would achieve this and can be done in SAS using proc npar1way. In your case, the variable after "class" is the grouping variable (the year of the survey). The variable after "var" is the variable we want to compare across years (score).
proc npar1way data=all_years;
class year;
var score;
run;
More info on using the npar1way procedure can be found here.
A good first step would be to combine all 3 years into 1 dataset. You could do this using the (in=) dataset option.
data all_years;
set survey2012(in=s12) survey2015(in=s15) survey2018(in=s18);
if s12 then year = 2012;
if s15 then year = 2015;
if s18 then year = 2018;
run;
Because you have discrete responses (1, 2, 3, or 4), comparing the medians of the groups rather than means might be a good option. A Kruskal Wallis test would achieve this and can be done in SAS using proc npar1way. In your case, the variable after "class" is the grouping variable (the year of the survey). The variable after "var" is the variable we want to compare across years (score).
proc npar1way data=all_years;
class year;
var score;
run;
More info on using the npar1way procedure can be found here.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.