BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
brook2
Fluorite | Level 6

I have a data set with 140 rows and 81 variables including the dependent variable, I want to include all of the variables to do backward elimination for designing regression model. How do i enter all of the variables at once. I found a similar question here in the following link but the answer is to vague to reproduce in my own data set 

 

proc glm data = train plot ;
model SalePrice = GrLivArea ........ 80 variables ;
run;

 

what if there is categorical variable , how do i address that when selecting predicting worthiness , binary coding may help but what if 0 is selected and not 1 in the selection criterion. The data also have almost 24 variables char data type and the rest are numeric. How do I address the problem as

 

proc glmselect data=TrainSubset;

will give an error saying 

 

ERROR: Variable BsmtFinType1 should be either numeric or specified in the CLASS statement

 

 

I have found same discussion thread here but found it to vague and complicated 

         https://blogs.sas.com/content/iml/2017/02/13/run-1000-regressions.html

 

Thank you !!! 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

proc glmselect data=TrainSubset;

will give an error saying

 

ERROR: Variable BsmtFinType1 should be either numeric or specified in the CLASS statement

 

You haven't specified BsmtFinType1 properly, as the error message states. If it is numeric (is it?) then you need to take it out of the CLASS statement. If it is categorical (is it?), then you need to put it in the CLASS statement.

 

I have a data set with 140 rows and 81 variables including the dependent variable, I want to include all of the variables to do backward elimination for designing regression model.

 

Go to Google and type in "problems with stepwise regression", and read some of those articles. Then, don't do stepwise or backwards or forwards variable selection.

 

Consider doing Partial Least Squares Regression on this data (PROC PLS in SAS), as PLS is known to have better properties than any form of stepwise on data like this.

--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

proc glmselect data=TrainSubset;

will give an error saying

 

ERROR: Variable BsmtFinType1 should be either numeric or specified in the CLASS statement

 

You haven't specified BsmtFinType1 properly, as the error message states. If it is numeric (is it?) then you need to take it out of the CLASS statement. If it is categorical (is it?), then you need to put it in the CLASS statement.

 

I have a data set with 140 rows and 81 variables including the dependent variable, I want to include all of the variables to do backward elimination for designing regression model.

 

Go to Google and type in "problems with stepwise regression", and read some of those articles. Then, don't do stepwise or backwards or forwards variable selection.

 

Consider doing Partial Least Squares Regression on this data (PROC PLS in SAS), as PLS is known to have better properties than any form of stepwise on data like this.

--
Paige Miller
Ksharp
Super User

Best way is typing these variables one by one .

Or try this one .I am not sure if it work.

'SalePrice ' must be in the first position.

 

proc glm data = train plot ;

class _character_ ;
model SalePrice = First_X_Variable -- Last_X-Variable ;
run;

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 713 views
  • 0 likes
  • 3 in conversation