I have a dataset that contains several variables from which, I'd like to know if the mean AGE in the "population" vary by GENDER, while controlling for RACE?
In this case Y = AGE (continuous variable)
X1 = GENDER and X2 = RACE (both X1 and X2 are categorical variables)
Since the question asks about "population" and not sample, I chose to use weight variables. However, I am not sure how to let SAS know that I am controlling for a variable "RACE"?
This is what I am using as of now...
proc surveyreg data = myfile;
class GENDER RACE;
weight weightvariable;
strata stratavariable;
cluster clustervariable;
model AGE = GENDER RACE / solution;
run;
I think this is right, you might want to add the LSMEANS command to get the estimated means by gender, adjusting for race.
Hi Paige,
Thank you for the response. Could you provide the code for adding LSMEANS in this case?
lsmeans gender race;
Thank you. So, will this be my complete code?
proc surveyreg data = myfile;
class GENDER RACE;
weight weightvariable;
strata stratavariable;
cluster clustervariable;
model AGE = GENDER RACE / solution;
lsmeans GENDER RACE;
run;
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.