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

As in a subject.

 

data have;
set sashelp.cars;
isUSA = Origin="USA";
run;

proc logistic data=have;
model isUSA=EngineSize Cylinders Horsepower;
output out=pred p=p;
run;

data want;
keep p p_manual;
set pred;
p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize 
+0.5735*Cylinders 
+0.0334*Horsepower));
run;

Why is p different than p_manual variable in the want dataset?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

How different?
Here's an example showing results that match exactly.
https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-logistic-regression-formula-f...

 

You were missing a set of brackets in your formula:

 

p_manual = 1/(1+EXP(-1 * (0.3199 -3.091*EngineSize 
+0.5735*Cylinders 
+0.0334*Horsepower)));

@Jedrek369 wrote:

As in a subject.

 

data have;
set sashelp.cars;
isUSA = Origin="USA";
run;

proc logistic data=have;
model isUSA=EngineSize Cylinders Horsepower;
output out=pred p=p;
run;

data want;
keep p p_manual;
set pred;
p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize 
+0.5735*Cylinders 
+0.0334*Horsepower));
run;

Why is p different than p_manual variable in the want dataset?

 

Thanks.


 

View solution in original post

3 REPLIES 3
Reeza
Super User

How different?
Here's an example showing results that match exactly.
https://communities.sas.com/t5/Statistical-Procedures/How-to-determine-logistic-regression-formula-f...

 

You were missing a set of brackets in your formula:

 

p_manual = 1/(1+EXP(-1 * (0.3199 -3.091*EngineSize 
+0.5735*Cylinders 
+0.0334*Horsepower)));

@Jedrek369 wrote:

As in a subject.

 

data have;
set sashelp.cars;
isUSA = Origin="USA";
run;

proc logistic data=have;
model isUSA=EngineSize Cylinders Horsepower;
output out=pred p=p;
run;

data want;
keep p p_manual;
set pred;
p_manual = 1/(1+EXP(-1 * 0.3199 -3.091*EngineSize 
+0.5735*Cylinders 
+0.0334*Horsepower));
run;

Why is p different than p_manual variable in the want dataset?

 

Thanks.


 

Jedrek369
Fluorite | Level 6

Shoot. That's embarrassing. Thanks anyway.

FreelanceReinh
Jade | Level 19

Tip: The formula

p_manual = 1/(1+EXP(-1 * (...)));

can be simplified to

p_manual = logistic(...);

(see LOGISTIC function).

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
  • 745 views
  • 13 likes
  • 3 in conversation