BookmarkSubscribeRSS Feed
greenie
Obsidian | Level 7

I have several outcomes of interest and exposures of interest and I want to run many MLR to see the relationships, but this is very tedious, so I want to know how can I use macro to simplify the process.

 

My code:

proc glm data = xxx;

model A B C =smoke nutrient smoke*nutrient  height Age sex race BMI education;

run;

 

A, B, and C are my outcomes of interest.

I want to change the "nutrient" in each MLR, e.g. fat, protein, carbs...

So I want to run the model of A and fat, B and fat, C and fat, A and protein, B and protein......

5 REPLIES 5
PaigeMiller
Diamond | Level 26

So I want to run the model of A and fat, B and fat, C and fat, A and protein, B and protein......

 

Please explain further. This seems to contradict your MODEL statement in PROC GLM which has models with 9 or 10 factors.

--
Paige Miller
greenie
Obsidian | Level 7

Hi thank you for reply.

I have 3 outcomes, and 300 of nutrients and smoke as exposures. Others in the right side of the "=" are covariates (confounders). Each time I can only run:

 

model (1 outcome) = smoke (1 nutrient)  smoke*(1 nutrient)  height Age sex race BMI education;

 

So basically I need to loop all the nutrients, otherwise I need to run the model 3*300=900 times.

PaigeMiller
Diamond | Level 26

First, after you run these 900 models, then what will you do with all that information?

 

Let me suggest a complete change of direction. My suggestion is to stop using linear regression and use Partial Least Squares regression (PROC PLS in SAS). This was specifically designed for cases where you have lots of variables, that are correlated with one another, and multiple response variables. You fit one model, and then PLS tells you which variables are the important predictors, which variables are correlated with one another, and even which of your y-variables are correlated with other y-variables. 

 

One PLS model, which provides a lot of information, or 900 OLS models. I go with PLS almost every time. And therefore, writing a macro to do what you want is unnecessary.

--
Paige Miller
greenie
Obsidian | Level 7
I want to know which nutrients that interact with smoke can impact my exposure (3 different aspects of lung function). So I want to check the interaction items' p-value. So 900 models I need to check 900 interaction items' p-value.
PaigeMiller
Diamond | Level 26

Ok, PLS can do everything you ask, and does it better than linear regressions.

 

If your problem has to have 900 regressions, then I will leave the problem to others to help you create such a macro.

--
Paige Miller

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!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 537 views
  • 1 like
  • 2 in conversation