BookmarkSubscribeRSS Feed
Mruizv
Obsidian | Level 7

Hello, calculated a logistic regression with HPGENSELECT as I needed stepwise to calculate the model. After some search can't find the appropriate code to substitute the variables for which the parameters made it on the regression

Any idea is greatly appreciated. (want: color 1 weight 2.5)

or should I run the second part with something other than HPGENSELECT?

proc hpgenselect data=crab;
class Spine;
model Satellite= Color Weight Color*Weight /distribution=poisson link=log; 
run;


 

3 REPLIES 3
czejap
SAS Employee

Hello

 

not sure if your question is about scoring of the new cases or definition of input variable types. Attached is code that might help you (data are toy example):

/*see https://support.sas.com/documentation/onlinedoc/stat/141/hpgenselect.pdf*/
/*of https://support.sas.com/documentation/onlinedoc/stat/143/stathpug.pdf*/
proc hpgenselect data=sashelp.class ;
class   sex;
model age= sex weight sex*weight ;*/link=log distribution=poisson ; 
selection 
	METHOD=STEPWISE 
	DETAILS=all
;
output out=myOut xbeta predicted=Pred;
code File='c:\temp\ScoringParameters.sas';
run;

data to_be_predicted;
sex='F'; weight=88; output;
sex='M'; weight=99; output;
run;

data prediction;
set to_be_predicted;
%include 'c:\temp\ScoringParameters.sas';
run;
proc print data=prediction;run;

data all_in_hpgenselect;
set sashelp.class to_be_predicted;
run;
proc print data=all_in_hpgenselect;run;

proc hpgenselect data=all_in_hpgenselect ;
class   sex;
model age= sex weight sex*weight ;*/link=log distribution=poisson ; 
selection 
	METHOD=STEPWISE 
	DETAILS=all
;
ID name sex age weight;
output out=myOut_with_prediction xbeta predicted=Pred;
code File='c:\temp\ScoringParameters.sas';
run;
proc print data=myOut_with_prediction;run;

 

Mruizv
Obsidian | Level 7

Not looking for the scoring but just a substitution on the regression.

Isn't there an option like set weight="2.5" or something similar? 

ballardw
Super User

@Mruizv wrote:

Not looking for the scoring but just a substitution on the regression.

Isn't there an option like set weight="2.5" or something similar? 


That sounds like a pass through a data step setting all the values of a variable to that fixed value. But I can't tell if you want this before regression (which is going to very drastically change any model) or in some form of output, at which point I'm not sure of the utitlity.

 

Or do you mean set the estimated parameter???

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!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 458 views
  • 0 likes
  • 3 in conversation