BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
AliF
Fluorite | Level 6

Hi

 

I am looking for a SAS macro to perform stepwise model selection for PROC GENMOD when the data is longitudinal (i.e. REPEATED statement in PROC GENMOD).

I found the below article which describes a SAS macro. 

Does anyone have code to full macro? Or code to a similar macro doing the model selection?

 

https://www.pharmasug.org/proceedings/2012/SP/PharmaSUG-2012-SP09.pdf 

 

Best regards
Ali

1 ACCEPTED SOLUTION

Accepted Solutions
lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You should check out this article from the SAS Global Forum:

chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://support.sas.com/resources/papers/proceedings14/1822-2014.pdf

It deals with stepwise selection using GLIMMIX. In GLIMMIX you can basically fit most of the models of GENMOD, and many more. But the syntax of GLIMMIX is different for repeated measures/longitudinal data (similar, but different enough to be confusing). 

 

But I must say: be very cautious when doing stepwise selection (using these traditional approaches). There are a lot of statistical reasons why this may not be a good idea. The newer methods in GLMSELECT, etc, are much better (but as you noticed, no way to deal with correlated data).

View solution in original post

7 REPLIES 7
sbxkoenk
SAS Super FREQ

Use HPGENSELECT instead !

 

Koen

AliF
Fluorite | Level 6

Hi Koen

Thank you for your reply.

For longitudinal binary data "REPEATED" option needs to used in PROC GENMOD in order to analyze such data.

I can't see the "REPEATED" option offered in HPGENSELECT.

How can I use HPGENSELECT for longitudinal data?

 

Best regards

Ali

sbxkoenk
SAS Super FREQ

You are right:
PROC HPGENSELECT does not support a REPEATED statement.

Sorry I had overlooked that.

 

I have just looked into the GEE procedure. That's the generalized estimating equations (GEE) approach (Liang and Zeger
1986), which extends the generalized linear model to handle longitudinal data.
But also there I cannot see effect selection and model selection capabilities.

 

PROC GLIMMIX is also not offering this.

 

Maybe @StatDave can help you out?

 

NB: in my previous post , I should also have given this example/article as well:
Home > Programming > Code examples
High-Performance Variable Selection for Generalized Linear Models: PROC HPGENSELECT
Started 3 weeks ago | Modified 3 weeks ago
https://communities.sas.com/t5/SAS-Code-Examples/High-Performance-Variable-Selection-for-Generalized...

 

Koen

Ksharp
Super User
In PROC MIXED ,you could use SOLUTION option to check which fixed effect is significant .
model y=x1 x2 ..../ solution ;

use COVTEST option to check which random effect is significant.
proc mixed ....... covtest;

And PROC GLIMMIX have the similliar options.

In PROC GENMOD , you could check ASSCEE statement, but I am not sure if that is what you are looking for.

Anyway, @SteveDenham @lvm maybe have better choice .
sbxkoenk
SAS Super FREQ

@Ksharp wrote:
In PROC GENMOD , you could check ASSCEE statement, but I am not sure if that is what you are looking for.

I think @Ksharp refers to the ASSESS|ASSESSMENT statement.
It's for 
Assessment of Models Based on Aggregates of Residuals.

 

Thanks @Ksharp  , it's a nice discovery ... I have never used that statement (and never noticed its existence).

 

Koen

lvm
Rhodochrosite | Level 12 lvm
Rhodochrosite | Level 12

You should check out this article from the SAS Global Forum:

chrome-extension://efaidnbmnnnibpcajpcglclefindmkaj/https://support.sas.com/resources/papers/proceedings14/1822-2014.pdf

It deals with stepwise selection using GLIMMIX. In GLIMMIX you can basically fit most of the models of GENMOD, and many more. But the syntax of GLIMMIX is different for repeated measures/longitudinal data (similar, but different enough to be confusing). 

 

But I must say: be very cautious when doing stepwise selection (using these traditional approaches). There are a lot of statistical reasons why this may not be a good idea. The newer methods in GLMSELECT, etc, are much better (but as you noticed, no way to deal with correlated data).

AliF
Fluorite | Level 6

Thank you all for providing responses to my question. Much appreciated.
I will look into https://support.sas.com/resources/papers/proceedings14/1822-2014.pdf and see how to modify for my need.

 

I also came across this article which deals with Backward Selection method, and I also want to modify this macros for Forward/Stepwise Selection method:
https://www.lexjansen.com/nesug/nesug07/cc/cc26.pdf 

 

Best regards

Ali
 

 

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!

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
  • 7 replies
  • 1428 views
  • 4 likes
  • 4 in conversation