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

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- out of sample regression testing with sas studio

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

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

Posted 03-11-2020 11:48 AM
(339 views)

I am very very very new to SAS and to be fair I haven't learnt from the start, I was just thrown into producing regressions, so I am not very acquainted with the language.

I have two excel datasets, one for training and one for testing the regression.

What I want to know is how to use the fitted logistic regression to "predict" the classes for the test set.

I am not running these regressions by writing the code myself, I am simply adjusting the settings. Nonetheless, here's the code that I get

from training the logistic regression:

```
ods noproctitle;
ods graphics / imagemap=on;
proc logistic data=WORK.TRAIN2 plots=(roc);
class checking_1 checking_23 savings_1 savings_23 amount_to1400
amount_1400to1600 amount_1600to2200 amount_2200to3800 purpose_189 purpose_26
purpose_05 / param=glm;
model Good(event='1')=checking_1 checking_23 savings_1 savings_23
amount_to1400 amount_1400to1600 amount_1600to2200 amount_2200to3800
purpose_189 purpose_26 purpose_05 / link=logit technique=fisher;
run;
```

My test dataset is called TEST2. How can I achieve this?

3 REPLIES 3

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

Here's a blog post that illustrates 4 different ways of doing this. Don't try PLM if this is all new to you.

https://blogs.sas.com/content/iml/2014/02/19/scoring-a-regression-model-in-sas.html

There's also a full example in the documentation for PROC LOGISTIC (see the little link under the heading to the full code so you can run and test the example).

@catkat96 wrote:

I am very very very new to SAS and to be fair I haven't learnt from the start, I was just thrown into producing regressions, so I am not very acquainted with the language.

I have two excel datasets, one for training and one for testing the regression.

What I want to know is how to use the fitted logistic regression to "predict" the classes for the test set.

I am not running these regressions by writing the code myself, I am simply adjusting the settings. Nonetheless, here's the code that I get

from training the logistic regression:

`ods noproctitle; ods graphics / imagemap=on; proc logistic data=WORK.TRAIN2 plots=(roc); class checking_1 checking_23 savings_1 savings_23 amount_to1400 amount_1400to1600 amount_1600to2200 amount_2200to3800 purpose_189 purpose_26 purpose_05 / param=glm; model Good(event='1')=checking_1 checking_23 savings_1 savings_23 amount_to1400 amount_1400to1600 amount_1600to2200 amount_2200to3800 purpose_189 purpose_26 purpose_05 / link=logit technique=fisher; run;`

My test dataset is called TEST2. How can I achieve this?

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

Thank you so much! The second link was really useful and now I can do it for logistic regression.

I also need to do the same for linear regression (with the same datasets too), but I find that the initial code is a bit different, so I'm not sure the outmodel/inmodel thing works.

Do you happen to have a link to the documentation that explains this too?

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

The PROC SCORE documentation has one for PROC REG.

https://documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_score_examples...

https://documentation.sas.com/?docsetId=statug&docsetVersion=14.3&docsetTarget=statug_score_examples...

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.