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

Let's assume I have several explanatory variables such as X1, X2, ..., Xn and one dependent variable which is Y.

I want to create regression for all possible paired combinations of X. For example:

y~x1 x2

y~x1 x3

y~x1 x4

...

y~ x10 x11.

What kind of a macro do i need?

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

All possible regressions in SAS

https://support.sas.com/kb/24/986.html

 

Of course, you asked how to do it, I provide the answer. Is it a good thing to do? Do people actually use this method in general? Well, NO to both questions. If you want to select variables, there are many more effective approaches, including PROC GLMSELECT and PROC PLS.

--
Paige Miller

View solution in original post

4 REPLIES 4
PaigeMiller
Diamond | Level 26

All possible regressions in SAS

https://support.sas.com/kb/24/986.html

 

Of course, you asked how to do it, I provide the answer. Is it a good thing to do? Do people actually use this method in general? Well, NO to both questions. If you want to select variables, there are many more effective approaches, including PROC GLMSELECT and PROC PLS.

--
Paige Miller
BurakY
Calcite | Level 5

Thanks a lot @PaigeMiller . The macro does even more than I need.

BurakY
Calcite | Level 5

Maybe 1 more question. How can I customize this macro to get all possible combination with only 2 independent variables? Because it takes a lot of time macro to run and I don't need combinations with more than 2 independent variables.

Thanks in advance.

PaigeMiller
Diamond | Level 26

As I stated, running many regressions is not a good method. I am reluctant to advise you on modifying code from a method that I think is ineffective. Use PROC GLMSELECT to select variables to put into a regression, or use  PROC PLS.

--
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!

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.

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