BookmarkSubscribeRSS Feed
coolmac
Calcite | Level 5

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;

5 REPLIES 5
PaigeMiller
Diamond | Level 26

I think this is right, you might want to add the LSMEANS command to get the estimated means by gender, adjusting for race.

--
Paige Miller
coolmac
Calcite | Level 5

Hi Paige,

 

Thank you for the response. Could you provide the code for adding LSMEANS in this case?

PaigeMiller
Diamond | Level 26
lsmeans gender race;
--
Paige Miller
coolmac
Calcite | Level 5

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;

PaigeMiller
Diamond | Level 26

Seems good to me. Maybe someone else ( @PGStats @ballardw @Reeza @Rick_SAS ) might want to look it over, if they have the time and interest.

--
Paige Miller

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 989 views
  • 0 likes
  • 2 in conversation