LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2007, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 19 Oct 2007 15:17:03 -0000
Reply-To:     ginanicolosi@HOTMAIL.COM
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Gina Nicolosi <ginanicolosi@HOTMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Use all numeric variables as predictors in proc reg
Comments: To: sas-l@uga.edu
In-Reply-To:  <1192567485.658959.211720@k35g2000prh.googlegroups.com>
Content-Type: text/plain; charset="us-ascii"

On Oct 16, 3:44 pm, ginanicol...@hotmail.com wrote: > I am writing a program which randomly selects predictor variables to > be included in a regression. Since the predictors during any one > iteration can change, I can't write them out in the MODEL statement. > Therefore, I was wondering if there was any way to specify that all > numeric variables in the data set act as regressors? Kind of like > putting _ALL_ or _NUMERIC_ after the equals sign when running PROC REG > (but this approach doesn't work). Any guidance would be greatly > appreciated.

Thanks so much for the suggestions.

At first, I found a solution using IML, but since I've never used that PROC before, I had to canibalize someone's posted IML regression code, and I wasn't terribly comfortable with running something I didn't understand.

I am also embarrassed to say that my experience with macro programs and variables is also limited. However, I was able to work the code below (written by Stuart Long) into the macro I wrote:

data whatever; if 0 then set mydata; length numerics $32767; array num_vars {*} _NUMERIC_ ; do i = 1 TO DIM(num_vars); numerics=CATX( " " , numerics , VNAME(num_vars{i}) ); end; call symputx("regressors",numerics); stop; run; %let dependent = y; %let regressors= %SYSFUNC(TRANWRD(&regressors,&dependent,)); proc reg data=mydata; model &dependent = &regressors ; run; quit;

Finally, thank you Howard and Mary for your suggestions. I have never used DICTIONARY.COLUMNS before, so I will investigate what it does.

Again, thanks so much! - gina


Back to: Top of message | Previous page | Main SAS-L page