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

 

proc surveyreg data=crdsimple;
class sic fyear idvc ids loss;
model rating = sic fyear logat roa lev idvc ids loss/ solution;
run;
data crd2;
set crdsimple;
rtmade = 16.8313718 -0.9310491*logat-1.0102761*roa+0.7764174*lev-2.4251711*idvc-0.4183952*ids+1.5549358*loss ;
run;
data crd3;
set crd2;
if sic = 0100 then rtmade1 = rtmade+2.9293598;
if fyear = 1993 then rtmade2 = rtmade1-3.5688886;
if sic = 1000 then rtmade1 = rtmade+2.4553097;
if fyear = 2008 then rtmade2 = rtmade1--1.0594573;
run;

Hi!!!!

 

Throughout the above codes, I could obtain coefficient to estimate by dependent variable!

However, the problem is... that I have so many categorical variables and need to input so many coefficients of SICs and FYEARs.

As you can see the last code, I did a little but I have more than 500 categories...

 

Does anyone know better ways to code to reflect categorical coefficients?

 

I appreciate your helpful comments so much!!!!

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

@JKCho wrote:

 

proc surveyreg data=crdsimple;
class sic fyear idvc ids loss;
model rating = sic fyear logat roa lev idvc ids loss/ solution;
run;
data crd2;
set crdsimple;
rtmade = 16.8313718 -0.9310491*logat-1.0102761*roa+0.7764174*lev-2.4251711*idvc-0.4183952*ids+1.5549358*loss ;
run;
data crd3;
set crd2;
if sic = 0100 then rtmade1 = rtmade+2.9293598;
if fyear = 1993 then rtmade2 = rtmade1-3.5688886;
if sic = 1000 then rtmade1 = rtmade+2.4553097;
if fyear = 2008 then rtmade2 = rtmade1--1.0594573;
run;

Hi!!!!

 

Throughout the above codes, I could obtain coefficient to estimate by dependent variable!

However, the problem is... that I have so many categorical variables and need to input so many coefficients of SICs and FYEARs.

As you can see the last code, I did a little but I have more than 500 categories...

 

Does anyone know better ways to code to reflect categorical coefficients?

 

I appreciate your helpful comments so much!!!!


So, where are those coefficients coming from? If you mean that you need to use something from the output of the Surveyreg procedure then you should direct the needed output into a data set from the proc.

 

maybe

proc surveyreg data=crdsimple;
class sic fyear idvc ids loss;
model rating = sic fyear logat roa lev idvc ids loss/ solution;
ods output Parameterestimates =work.parms;
run;

And work.parms would have the coefficients needed.

 

You would likely need to transpose modify the output set to use in the fashion you are attempting.

View solution in original post

3 REPLIES 3
ballardw
Super User

@JKCho wrote:

 

proc surveyreg data=crdsimple;
class sic fyear idvc ids loss;
model rating = sic fyear logat roa lev idvc ids loss/ solution;
run;
data crd2;
set crdsimple;
rtmade = 16.8313718 -0.9310491*logat-1.0102761*roa+0.7764174*lev-2.4251711*idvc-0.4183952*ids+1.5549358*loss ;
run;
data crd3;
set crd2;
if sic = 0100 then rtmade1 = rtmade+2.9293598;
if fyear = 1993 then rtmade2 = rtmade1-3.5688886;
if sic = 1000 then rtmade1 = rtmade+2.4553097;
if fyear = 2008 then rtmade2 = rtmade1--1.0594573;
run;

Hi!!!!

 

Throughout the above codes, I could obtain coefficient to estimate by dependent variable!

However, the problem is... that I have so many categorical variables and need to input so many coefficients of SICs and FYEARs.

As you can see the last code, I did a little but I have more than 500 categories...

 

Does anyone know better ways to code to reflect categorical coefficients?

 

I appreciate your helpful comments so much!!!!


So, where are those coefficients coming from? If you mean that you need to use something from the output of the Surveyreg procedure then you should direct the needed output into a data set from the proc.

 

maybe

proc surveyreg data=crdsimple;
class sic fyear idvc ids loss;
model rating = sic fyear logat roa lev idvc ids loss/ solution;
ods output Parameterestimates =work.parms;
run;

And work.parms would have the coefficients needed.

 

You would likely need to transpose modify the output set to use in the fashion you are attempting.

JKCho
Pyrite | Level 9
A quick solution was simple out p=pred... but I learned stm new from you too! Thx!!!
Reeza
Super User
If you're looking to take a model and apply those results to new data, the term is often called Scoring a new data set and there's PROC SCORE, PROC PLM or SCORE statements within procs that automate this process so you don't need to code it yourself.

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
  • 661 views
  • 2 likes
  • 3 in conversation