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

Hi,

 

I'm performing a binary logistic regression, but I want to calculate the probability for each record and append it to the data set, does anyone know how to do this?

 

Best,

1 ACCEPTED SOLUTION

Accepted Solutions
ed_sas_member
Meteorite | Level 14

Hi @jardielbarrera 

 

You can use a SCORE statement to score the same dataset as follows -> it will output individual predicted probabilities in column P_1

proc logistic data=<yourdata>;
	model y (event="1") = <x1 x2>;
	score data=<yourdata> out=want;
run;

The results are identical to the approach suggested by @PGStats , using an OUTPUT statement and the PREDPROBS option assuming you request individual (and not cumulative) probabilities.

proc logistic data=<yourdata>;
	model y (event="1") = <x1 x2>;
	output out=want predprobs=(individual);
run;

Best,

View solution in original post

4 REPLIES 4
jardielbarrera
Calcite | Level 5
Thanks. It works. Very useful.
ed_sas_member
Meteorite | Level 14

Hi @jardielbarrera 

 

You can use a SCORE statement to score the same dataset as follows -> it will output individual predicted probabilities in column P_1

proc logistic data=<yourdata>;
	model y (event="1") = <x1 x2>;
	score data=<yourdata> out=want;
run;

The results are identical to the approach suggested by @PGStats , using an OUTPUT statement and the PREDPROBS option assuming you request individual (and not cumulative) probabilities.

proc logistic data=<yourdata>;
	model y (event="1") = <x1 x2>;
	output out=want predprobs=(individual);
run;

Best,

jardielbarrera
Calcite | Level 5
Thanks a lot. It works.

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 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 731 views
  • 2 likes
  • 3 in conversation