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: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 3 replies
  • 596 views
  • 0 likes
  • 3 in conversation