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

Hi, 

I am trying to decide which model would best be suited for my study. I have two continuous variables A (independent) and B (response). We are measuring these for 20 hospitals for each month across the year 2020 - so each hospital has 12 values for each month for each variable. I am currently using proc genmod with the repeated statement to account for clustering within each hospital. Wondering what might be a good way to account for time in this case? Sharing my code below:

 

proc genmod data = dataset;

class hospid;

model B = A ;

repeated subject = hospid;

run;

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

You can specify your Month variable in the WITHIN= option in the REPEATED statement and then, if desired, use a correlation structure such as TYPE=AR that allow the correlation strength to diminish with time.

View solution in original post

5 REPLIES 5
StatDave
SAS Super FREQ

You can specify your Month variable in the WITHIN= option in the REPEATED statement and then, if desired, use a correlation structure such as TYPE=AR that allow the correlation strength to diminish with time.

analyst_work
Obsidian | Level 7
Is there a way to replicate this using proc glimmix instead?
jiltao
SAS Super FREQ
proc glimmix data = dataset;
class hospid month;
model B = A ;
random month / residual subject = hospid type=ar(1);
run;
analyst_work
Obsidian | Level 7
Thanks! One follow-up question - my variable A is a continuous variable, and will not appear in the class statement. How do I use lsmeans (or something similar) to get the rate estimates in this case? Thanks!
jiltao
SAS Super FREQ

What exactly do you want to estimate for A? 

Depends on what you want to estimate, you might use the S option in the MODEL statement to get the slope estimate for A, or use the ESTIMATE statement. For example,

proc glimmix data = dataset;
class hospid month;
model B = A ;
random month / residual subject = hospid type=ar(1);

estimate 'response when A=5' int 1 A 5;
run;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 5 replies
  • 1608 views
  • 6 likes
  • 3 in conversation