I am very new to stats and have only taken one course so far (which did not cover this) so I am a little out of my wheelhouse. Thank you in advance for any help you can give.
I am working in SAS and am trying to figure out how to write a code where I can determine which, if any, of these predictors affect my outcome "value".
Details on my data: 4 groups basically, young female adults, senior female adults, young male adults, senior male adults. I have recorded a value for each group, but want to analyse this data continously rather than by group since each group ranges in age values. So far my data (and code that I have tried, and failed) looks something like this:
/*Test Data*/
Data;
input Sex$ Age Value;
cards;
M 13 1
M 3 0.5
F 2 0.6
M 3 0.5
M 3 0.5
M 3 0.5
F 1 0.6
F 11 1.2
F 2 0.6
M 3 0.5
M 13 1
F 2 0.6
F 3 0.6
F 3 0.6
M 9 1
M 1 0.5
M 9 1
M 9 1
F 13 1.2
M 11 1
F 11 1.2
M 11 1
M 3 0.5
F 3 0.6
M 3 0.5
M 1 0.5
M 16 1
M 11 1
M 3 0.5
M 1 0.5
M 2 0.5
F 9 1.2
F 9 1.2
M 3 0.5
F 2 0.6
F 12 1.2
F 9 1.2
;
run;
proc reg;
model Value= Age Sex;
run;
proc reg;
model Value= Age;
run;
proc reg;
model Value= Sex;
run;
Proc reg;
model Value= Age Sex / selection= stepwise slentry=0.05;
run;
proc corr;
var Sex Age Value;
run;
I haven't even managed to put the weight predictor in there because I'm not sure how to add it. My code also does not like Sex being there.
I really just need to figure out if age, sex, or weight will affect my "value". Thank you in advance!
SEX is a CLASS variable so you either need to create a dummy variable for SEX and use that dummy variable in PROC REG, or use PROC GLM and a CLASS statement. For example,
proc glm data=<yourdatasetname>;
class sex;
model value = sex age / solution;
run;
quit;
or
data yourdata;
set yourdata;
Male=(sex='M');
run;
proc reg data=yourdata;
model value=male age;
run;
quit;
Hope this helps,
Jill
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.