Simple command in SAS for regression with a large number of covariates?


New Member
I'm a new poster and I searched before creating this thread, so I hope I'm not raising a common question that is constantly being answered here.

I've been using R for about 4 years now but am just beginning to use SAS. In R, given a data set called "data" with variables Y, X1, ..., Xp, I can call up a regression command in R:

lm(Y ~ ., data=data, ...)

Is there anything that corresponds to the function the period serves (i.e., calls in all the remaining variables) in SAS? Or do I need to explicitly write out all the variables I want included in the model? I've asked several people in person and none know how to do it. Thanks in advance.


Dark Knight
There are few macro variables like _numeric_ (all numeric variables) , _all_ can be used in PROC REG. But this include the response also.

I don't think a ready made solution available for replacing the "period in R". But one can write a macro to get this variables list (Using PROC CONTENTS) excluding the response.


Ninja say what!?!
There is no direct function in SAS that will do that. However, you can write up macros that will loop to do a regression on each of the variables.

Seeing that you're new to SAS, I think you should become comfortable first. Once you're ready, I'll try to show you how to make one.


Ambassador to the humans
Sometimes I wish there was a site similar to Rosetta Code that would have code snippets to show how you would accomplish certain stat analysis type tasks in the big stats languages (SAS, R, SPSS, ... I guess C).


New Member
I figured it would require a macro. Link, thanks for the offer to help in the future; I may take you up on it at some point. Learning R was trial by fire and I think it will be the same for SAS. Seems like the best way to learn these things anyway.