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 Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 350 views
  • 1 like
  • 2 in conversation