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

Dear SAS Community,

 

 

I am reposting my question from programming, that was moved to procedures and then recommended that it be posted here.

 

I am fitting a couple of generalized linear regression model with continuous outcomes: BUA, SOS, SI. The independent predictors are both categorical and continuous and my data is in long form. I would like to use PROC GENMOD for this, but I'm not sure if my code is calling the correct type of model. Do I need to include a repeated statement for the visit variable and how do I code the statement to make sure that it recognizes that ID X is repeated at VISIT X? 

 

Outcome=SOS (continuous)

Predictor=Group (dichotomous)

Time Variable=Visit (1,2,3)

 

This is my orginal code:

proc genmod data=qus;
	class group (ref="2") / param=ref;
	class id;
	model sos = group  visit  / dist=normal link=identity;
	run; 

It was suggested by @Ksharp that I use a repeated statement and code it as follows, but to also post it here and make sure this is a good way to model it.

 

proc genmod data=qus;
	class group (ref="2") / param=ref;
	class id;
	model sos = group  / dist=normal link=identity;
repeated subject=id / within=visit;
	run; 

Adding this statement doesn't have a tremendous effect on my model output. Have I accounted for these variables correctly?

 

 

Thanks!

Cara

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

That code is fine except you need to have VISIT in the CLASS statement if you are going to use it in the WITHIN= option. If you like, you can include both VISIT and the interaction with GROUP in your model if you want to see if those are significant effects on the response. Note that you can put several variables in one CLASS statement.

 

 

proc genmod data=qus;
	class id group (ref="2") visit (ref="1") / param=ref;
	model sos = group  visit group*visit / dist=normal link=identity;
        repeated subject=id / within=visit;
	run; 

 

Also, you might want to consider your response variable, SOS, and whether the normal distribution is appropriate. The normal is fine if you expect it to be reasonably symmetric about its mean in each group-visit combination. But if it is skewed, as could happen if it's positively valued with low mean, then other distributions like gamma or inverse gaussian might be better. Also, if you could consider other correlation structures for the measurements within subjects. The simple exchangeable structure (all measurements have the same, non-zero correlation) or the autoregressive structures are often used - TYPE=EXCH or TYPE=AR option in the REPEATED statement.

View solution in original post

3 REPLIES 3
greveam
Quartz | Level 8

I think proc mixed would work better for a repeated measurement setup with continuous outcome:

 

something like:

 

proc mixed data=have;
class visit id treatment;
model outcome = treatment visit treatment*visit / noint solution;
repeated / SUBJECT=id TYPE=UN;
lsmeans vist / cl pdiff;
run;
quit; 

StatDave
SAS Super FREQ

That code is fine except you need to have VISIT in the CLASS statement if you are going to use it in the WITHIN= option. If you like, you can include both VISIT and the interaction with GROUP in your model if you want to see if those are significant effects on the response. Note that you can put several variables in one CLASS statement.

 

 

proc genmod data=qus;
	class id group (ref="2") visit (ref="1") / param=ref;
	model sos = group  visit group*visit / dist=normal link=identity;
        repeated subject=id / within=visit;
	run; 

 

Also, you might want to consider your response variable, SOS, and whether the normal distribution is appropriate. The normal is fine if you expect it to be reasonably symmetric about its mean in each group-visit combination. But if it is skewed, as could happen if it's positively valued with low mean, then other distributions like gamma or inverse gaussian might be better. Also, if you could consider other correlation structures for the measurements within subjects. The simple exchangeable structure (all measurements have the same, non-zero correlation) or the autoregressive structures are often used - TYPE=EXCH or TYPE=AR option in the REPEATED statement.

cbt2119
Obsidian | Level 7

Thanks! I will check this out.

 

Cara

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 3 replies
  • 1185 views
  • 0 likes
  • 3 in conversation