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?
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.
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.
Thanks a lot @PaigeMiller . The macro does even more than I need.
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.
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.