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

Hi,

I am currently working on my thesis, and I am having trouble deciding how to run my linear mixed models mostly because the primary exposure variables and covariates are not from the same time point as my outcome variables. Additionally my data is currently in the wide format (one observation per subject, with variables from different time points being different variables rather than repeat measures). A little bit of info on my project/analysis plan: 

Analysis 1: Meddiet Score (averaged from 3 time points: year 0, 7, 20)  and brain MRI measures at 25 and 30 years of follow up. Confounding variables will be averaged from years 0, 7, and 20.

Analysis 2: The MedDiet scores at each individual time point (years 0, 7, and 20 analyzed separately) will  in relation to brain structures, adjusting for covariates (also from each separate time point).

I am working with about 7 brain measures, so i'll have several outcome variables. Additionally, not all participants have MRI data at both years 25 and 30, hence why I chose proc mixed since it can accommodate this issue. I know the code should look something like this for the outcome variables, but i know this won't work since the times don't line up with the covariates. Please let me know if you have any suggestions! Thank you so much in advance!

data mri2;
set mri;
wm=whimatter25 time=25 output;
wm=whimatter30 time= 30 output;
gm= greymatter25 time=30 output;
gm=greymatter30 time=30 output;
h=hippocampus25 time=25 output;
h=hippocampus30 time=30 output;
run;
proc mixed data=mri2;
class meddiet covariates;
model wm= meddiet time covariates meddiet*time/s rcorr;
repeated /type=un sub=id;
run

 

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

When you are converting wide to long, make sure you have a semicolon after each definition and one before the output statement.  For example:

 

wm=whimatter25; time=25; output;

Then in your PROC MIXED code, try using time as a categorical variable and adding it to the REPEATED statement.  Again, for example:

 

proc mixed data=mri2;
class meddiet covariates time id;
model wm= meddiet time covariates meddiet*time/s ;
repeated time /type=un sub=id rcorr;
run;

I would consider doing just one analysis if the covariates are fixed across timepoints, and using LSMESTIMATE statements to make the comparisons you want.  If the covariate vary by time, your approach is probably what I would do.  In that case, your model would drop all of the time and time interactions, as well as the repeated statement, and you would add a BY time; statement.

 

SteveDenham

 

View solution in original post

1 REPLY 1
SteveDenham
Jade | Level 19

When you are converting wide to long, make sure you have a semicolon after each definition and one before the output statement.  For example:

 

wm=whimatter25; time=25; output;

Then in your PROC MIXED code, try using time as a categorical variable and adding it to the REPEATED statement.  Again, for example:

 

proc mixed data=mri2;
class meddiet covariates time id;
model wm= meddiet time covariates meddiet*time/s ;
repeated time /type=un sub=id rcorr;
run;

I would consider doing just one analysis if the covariates are fixed across timepoints, and using LSMESTIMATE statements to make the comparisons you want.  If the covariate vary by time, your approach is probably what I would do.  In that case, your model would drop all of the time and time interactions, as well as the repeated statement, and you would add a BY time; statement.

 

SteveDenham

 

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
  • 1 reply
  • 574 views
  • 4 likes
  • 2 in conversation