A macro to run a simple linear regression with dependent and independent variables as macro parameters.
Dataset: sashelp.cars
Dependent variable =msrp; Independent variables = enginesize, cylinders, horsepower
What's your question? Please detail your question and show what you've tried and the issues your having.
Make the regression work as plain SAS code. Then it is a simple matter to transform it into a macro.
In general you don't need macros to do regression.
You need macros when you want your code to be dynamic and do different things in different situations.
SUGGESTION to @Merlin: you get much better answers, and quicker answers, if you avoid these extremely succinct problem statements, and actually take the time to explain your question, and why you think there are situations where macros might be needed.
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.