BookmarkSubscribeRSS Feed
Raza_M
Obsidian | Level 7

Hi,

I am using fixed effects with logistic regression for three observations per person. In my data there are three rows for each person. I have two questions.

My first question is if my code below is correct? Outcome is dichotomized with 0 as a reference and exposure is three months averaged continuous variable. Covariates are age in 11 categories, ses is socioeconomic status in three categories, married is dichotomized, humid_3mon is three month averaged humidity as continuous variable and so is temp_3mon (temperature) . I have not added continuous variables in the CLASS statement as it takes forever to run the code.

proc logistic data= analysis;
class  ses(ref='1') married(ref='1')/ param=ref;
model outcome(ref='0') = exposure age ses married temp_3mon humid_3mon/ expb;
strata id;
run;

My second question is, if I am adding confounders at different steps (step 1, only ses as a covariate, and in step 1, ses + married as covariates) do I need to list both covariates in the CLASS statement from step 1? I have given a syntax for both steps to show what I am trying to ask.

Step 1, I want to add only ses as a covariate in MODEL along with age and weather parameters. But I have listed married in the CLASS statement which I will test in step 2.

proc logistic data= analysis;
class  ses(ref='1') married(ref='1')/ param=ref;
model outcome(ref='0') = exposure age ses temp_3mon humid_3mon/ expb;
strata id;
run;

Step 2, 

proc logistic data= analysis;
class  ses(ref='1') married(ref='1')/ param=ref;
model outcome(ref='0') = exposure age ses married temp_3mon humid_3mon/ expb;
strata id;
run;
3 REPLIES 3
svh
Lapis Lazuli | Level 10 svh
Lapis Lazuli | Level 10
The answer may depend, in part, on whether there are any covariates with missing values in your data set. For when you add a variable to the CLASS statement, SAS uses that information to parameterize the model. So, for example, if any values of 'married' are missing, the observations with missing values will be dropped from the analysis in Step 1 even though 'married' is not a covariate. Personally, I only put the variables I'm using in the class statement to avoid listwise deletion that I'm not planning to see.
Raza_M
Obsidian | Level 7

Hi,

Thank for the reply!

I have several covariates and have missing values. In my actual model, I didn't list them all in the CLASS statement from the first step. I have added them in the CLASS statement in a model where I am controlling for them. My thinking behind was, some of the covariates added in the last steps might not be a strong confounder but due to missing values these might limit the power if I put them in the CLASS statement from the beginning. But then I got a comment that, sample population is different at each step when all the covariates are not listed in the CLASS statement in the first step.

In my results, I clearly see that at each step when I add covariates risk estimate doesn't change much but in the last step confidence intervals became wider.

I just want to be sure if what I am doing is correct.

StatDave
SAS Super FREQ
There is no need to put variables in the CLASS statement that are not also specified in the MODEL statement, and as mentioned, doing so can result in additional observations being ignored if the extra variables contain missing values. But if the extra variables contain no missings, then the results should be the same with or without them in the CLASS statement. You should never put continuous variables in the CLASS statement unless you want to treat them as categorical and they have relatively few values. Any variable in the CLASS statement is treated as categorical by internally creating a set of variables that are used in the design/model matrix to represent that variable.

If your continuous, 3 month averaged variables for a subject are the result of averaging the separate values from each of the observations for that subject, then you are just throwing away information. You might better use the separate values in each of the three observations for each subject.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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
  • 3 replies
  • 454 views
  • 1 like
  • 3 in conversation