BookmarkSubscribeRSS Feed
SimonSAS
Calcite | Level 5

Hello everyone,

I really tried to figure this out by searching the internet and reading through different pages as well as the SAS support page, but I didn't come to a solution.

My problem:

I want to analyse the association between different variables in groups/blocks and the outcome. Therefor I want to create a hierarchical linear regression model using proc reg. So for example, my variables are grouped in blocks like this:

Block1: Demographics (Variables A B C)

Block 2: Behaviors (Variables D E F)

Block 3: Parenting (Variables G H I)

So I want to create a SAS syntax/code using proc reg that first assesses the association between the variables of Block1 and the Outcome, and excludes all variables with a p-value over 0.05 in a backward elimination. Then only the variables that showed p<0.05 in Block1 are included in the model (e.g. only A and C) and the variables of Block2 are added (e.g. Out = A C (resulting out of the elimination process of the regression between Outcome and variables A B C of Block1) D E F (added variables of Block2) . Now, again only those variables which show p<0.05 stay in the model, except for the variables included from Block1, they shall stay in the model no matter how their p-value now changes (eg. A, E and F show p>0.05 the model will be Out = A C D because A is included from Block1 and is forced into the model where E and F are from Block2 and eliminated). The same will be done with Block3. The final model then might be Out = A C D H I (if only H and I showed p<0.05 in Block3).

It is kind of hard for me to describe my issue in a way that it hopefully makes sense to you. I tried a lot of different stuff but nothing worked the way it should... I created a syntax that assessed the association of the variables in the groups, also backward eliminated the variables, but then included the whole group into the next block anyway, not only those variables who showed p<0.05 in the step before... I really don't know how to fix that. I hope you can help me with my problem, I would really appreciate it,

Thank you,

Simon

1 REPLY 1
PGStats
Opal | Level 21

Have you tried the INCLUDE=n option in the MODEL statement to force the first n variables to be kept in the variable elimination process?

PG

PG

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 506 views
  • 0 likes
  • 2 in conversation