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