Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- Programming
- /
- Looking for simple codes to put mutiple coefficients

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 07-19-2019 03:59 PM
(603 views)

```
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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.

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

A quick solution was simple out p=pred... but I learned stm new from you too! Thx!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

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!

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.