BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
km0927
Obsidian | Level 7

Hello, I'm using ANCOVA for anlayzing RCT data.

I'm using Proc glm now. In ANCOVA, it seems to be common to use continous covariates, not categorical covariates.

 

However, in my data, the covariates are categorical variables(e.g. race, gender).

 

Is it right to use categorical variables as covariates in ANCOVA with proc glm function?

 

In proc glm, we can only use categorical variables with 'class statement'.

 

As I add variables in my model gradually, the results of main variables(independent variables) are changing.

 

It seems that the results of indepedent variables are being adjusted gradually.

 

However, I'm not sure about the process and outcome.

 

* In addition

 

There were some people who had similar problems with me, but the answers to them was a bit ambiguous for me, and most of them answer with SPSS syntax, not SAS.

 

the syntax is like below... for simplicity, I assume that there is no interaction between variables.


proc glm data=DATA plot=meanplot(cl);
class trt race gender;
model outcome = trt race gender age baseline/solution;
lsmeans trt/tdiff pdiff cl adjust = bon;
run;

 

As you see, trt is treatement, which is independent variables and race and gender are categorical covariates.

 

the results of lsmeans is changing as I add categorical covariates gradually, but is it right procedure?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

There's nothing wrong with categorical variables in a PROC GLM model, whether it is ANCOVA or ANOVA or any other model GLM can fit.

 

The problem is that as you add variables, then the effects of other variables will change (unless the added variable is orthogonal to the variables already in the model). This is expected behavior, but sometimes not pleasing from an intuitive point of view.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

There's nothing wrong with categorical variables in a PROC GLM model, whether it is ANCOVA or ANOVA or any other model GLM can fit.

 

The problem is that as you add variables, then the effects of other variables will change (unless the added variable is orthogonal to the variables already in the model). This is expected behavior, but sometimes not pleasing from an intuitive point of view.

--
Paige Miller
km0927
Obsidian | Level 7

Thanks! I really appreciate your help.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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