BookmarkSubscribeRSS Feed
Jasminalves
Calcite | Level 5

Hello all, 

 

I have a longitudinal study where participants come in for yearly visits and we assess metabolic outcomes and lifestyle factors as predictor variables. For example, how does sleep relate to BMI. I am trying to set up a proc mixed model but I am not sure how control for the fact that some participants contribute multiple observations to the dataset while others only contribute one. I am not interested in testing the effect of time, but rather how does sleep relate to BMI after controlling for some participants having multiple visits. 

 

Here is an example of my code: 

 

proc mixed data=a;
class id sex visit;
model BMI=accel_sleep_duration sex visit child_age / solution;
random visit id;
run;

 

Any suggestions would be appreciated! Thanks! 

1 REPLY 1
Ksharp
Super User

That would be better to post it at Statistical Forum(let @StatDave  @lvm  @SteveDenham  see it):

 

 

Here is the code I proposed.

proc mixed data=a;
class id sex visit;
model BMI=accel_sleep_duration sex visit child_age / solution;
random int/subject= id;
repeated visit/subject= id;
run;

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 418 views
  • 1 like
  • 2 in conversation