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

Hello:

  I hope to run a mixed model with proc mixed but get confused by the syntax of subject option in the repeated statement. Suppose we have several clinical trials which collects variables: response, treatment, patient_id, baseline, study_id. I saw someone using

proc mixed;

class patient_id drug;

model response = baseline treatment;

repeated / subject=study_id(patient_id) group=study_id;

run;

what does "study_id(patient_id)" means? None of the SAS books I have specify subject variable with another variable in parenthesis next to it. Really confused......

Thanks,

Peter

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

Peter,

There is a high likelihood that patient_id is unique within a study, but may not be across studies.  This nested characteristic gives rise to the parentheses notation.  However, if you inspect the parameterization documentation for PROC MIXED, you find that study_id(patient_id) and study_id*patient_id have identical matrix representations.  The repeated statement in the code snippet you provided thus guarantees (provide the data are clean) unique identification of each subject, and separate variance components due to study.

Steve Denham

View solution in original post

4 REPLIES 4
mohamed_zaki
Barite | Level 11

Although i think your code is typo

but this mean that you specify that your data is nested

check this for more clarification

http://www.thejuliagroup.com/documents/procmixed1.pdf

SteveDenham
Jade | Level 19

Peter,

There is a high likelihood that patient_id is unique within a study, but may not be across studies.  This nested characteristic gives rise to the parentheses notation.  However, if you inspect the parameterization documentation for PROC MIXED, you find that study_id(patient_id) and study_id*patient_id have identical matrix representations.  The repeated statement in the code snippet you provided thus guarantees (provide the data are clean) unique identification of each subject, and separate variance components due to study.

Steve Denham

Peter_Y
Calcite | Level 5

Is this the only reason for using the parentheses notation? If I create a unique id at patient level, I don't need parentheses notation? I am really confused when people start to talk about nested or crossover effects. I thought the parentheses notation has sth. to do with the model itself......


Thanks,

Peter

SteveDenham
Jade | Level 19

If patient id is unique, then you don't need the parenteheses (or crossed, for that matter) notation.

Steve Denham

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 4 replies
  • 3217 views
  • 0 likes
  • 3 in conversation