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
- /
- SAS Procedures
- /
- How to use the result of the store command from proc logistic

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 11-13-2019 04:56 PM
(1083 views)

I am close to achieving my Master's degree in Data Analysis and I am working on a Logistic analysis problem. I have noticed that Proc Logistic supports the store command to save the analysis. However, it is unclear how to use the saved binary to score another data set similar to doing so with Proc PLM. Proc PLM will use the stored data but it apparently doesn't score the same way as Proc Logistic as the predicted probabilities are significantly different. I assume it is still scoring like Proc GLM.

proc plm restore=cap.stored;

score data=cap.fnma_sf2017_prepared out=cap.fnma_st2017_scored;

run;

1 ACCEPTED SOLUTION

Accepted Solutions

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

> I will read through them later when I have time.

It's your choice, but you might discover that KSharp's suggestion will save you time. To focus your attention, the article

"4 reasons to use PROC PLM for linear regression models in SAS"

seems relevant. The examples demonstrate that you should use the ILINK option if you want the predicted probabilities. Otherwise, as you say, you are getting the linear predictions before applying the inverse logit transformation.

The article "Predicted values in generalized linear models: The ILINK option in SAS" provides additional discussion and a logistic example that demonstrates the difference between using and not using the ILINK option when coring new data.

8 REPLIES 8

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

You can use PROC LOGISTIC itself to score future values.

PROC PLM does explicitly state that the PROC LOGISTIC can be score so I'm surprised that it would be wrong. Can you illustrate your full use case and why you think it's incorrect?

PROC PLM does explicitly state that the PROC LOGISTIC can be score so I'm surprised that it would be wrong. Can you illustrate your full use case and why you think it's incorrect?

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

Yes. you are right PROC LOGISTIC is still scoring like Proc REG . Like:

predict_Y=a*x1+b*x2+..........

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

BTW, @Rick_SAS wrote many blogs about this topic .

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

Thank you for your reply and your suggestion to check out Rick's posts. I will read through them later when I have time. For now, if there is a way to use proc logistic to utilize saved binary parameters from the store statement, I would like to see an example of the syntax. If logistic scoring of new data using this saved data is currently missing functionality, that's fine. I would just like to know one way or the other before I finish my final report so I can be confident I know what I am talking about when I am demonstrating SAS abilities. I come from a background of Software Development / Engineering (mostly in C/C++) and dealing with the data involved, so the main thing I am adding to my skill set is the use of the advanced statistics. If you can answer whether it is possible / practical to use the saved parameters for logistic analysis on new data sets with an example of the syntax (if so), then I am satisfied for the moment.

In case you are curious, my project involves 2-3 yearly data sets each with over 2 million records where the target of my hypothesis is available in all 3. There is actually several more data set years available but I am limiting myself to those. I am splitting the first year for training and validation and testing with a different year by applying the scoring. Since I can always compare the prediction to the actual value of the target, I used a few sas procedures (data step and proc means / proc freq) to see how well it did. In the process I also computed a value to consider using for cutoff for the predicted values. It appeared I could use proc plm results to come somewhat close to the proc logistic results if I used a different cutoff for both. However the predicted values from proc plm could go negative etc while the proc logistic results were nicely bounded between 0 and 1, so it was obvious proc plm doesn't use logistic analysis unless there is a option I don't know about yet. If you want to see the steps here, I have to switch laptops. I am not running SAS University edition on this one.

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

> I will read through them later when I have time.

It's your choice, but you might discover that KSharp's suggestion will save you time. To focus your attention, the article

"4 reasons to use PROC PLM for linear regression models in SAS"

seems relevant. The examples demonstrate that you should use the ILINK option if you want the predicted probabilities. Otherwise, as you say, you are getting the linear predictions before applying the inverse logit transformation.

The article "Predicted values in generalized linear models: The ILINK option in SAS" provides additional discussion and a logistic example that demonstrates the difference between using and not using the ILINK option when coring new data.

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

I used the ilink option with proc plm. It was what I was looking for.

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

" If you can answer whether it is possible / practical to use the saved parameters for logistic analysis on new data sets with an example of the syntax (if so), then I am satisfied for the moment."

You can use OUTEST= option to save parameter estimator ,and use it to score a new or test data.

```
proc logistic data=sashelp.class outest=est;
model sex=age weight height;
run;
data test;
set sashelp.class;
run;
data score_test;
if _n_=1 then
set est(keep=intercept age weight height rename=(age=a weight=w height=h));
```

set test;
Y=intercept+a*age+w*weight+h*height;
/*as Rick said,if you want Prob ,using LOGIT() reverse Y*/
prob=logit(Y);
run;

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

PROC LOGISTIC also has the code statement. It will generate the SAS data step code needed to score the data.

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.