BookmarkSubscribeRSS Feed
Sanchit
Fluorite | Level 6

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

4 REPLIES 4
Reeza
Super User

What's your question? Please detail your question and show what you've tried and the issues your having.  

PGStats
Opal | Level 21

Make the regression work as plain SAS code. Then it is a simple matter to transform it into a macro.

PG
Merlin
Calcite | Level 5
I am want to know in which case we need macro language when doing regression ? Or Another preditif analysis
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1990 views
  • 0 likes
  • 5 in conversation