Help using Base SAS procedures

How SAS got the result without class statement in Proc Logistic

Accepted Solution Solved
Reply
New Contributor byn
New Contributor
Posts: 4
Accepted Solution

How SAS got the result without class statement in Proc Logistic

I am running proc logistic. There are one independent variable and one dependent variable. The independent variable is a numeric variable. I used format to make this variable have only 2 values, 'detect' and 'not detect'. The dependent variable only has two category, 0 and 1.

I did not add the class statement for the independent variable in proc logistic procedure and SAS still gave me result. This result is different from that of adding the class statement. I want to know how SAS got the result without the class statement.


Accepted Solutions
Solution
‎12-13-2013 10:46 PM
Super User
Posts: 19,860

Re: How SAS got the result without class statement in Proc Logistic

My guess....would be easy to test, but I'll assume you can do that Smiley Happy

Assuming the independent variable (IV) was a number, SAS treated it as a continuous variable.  If the values for the IV were not binary then the results would not be consistent between the two procedures.

View solution in original post


All Replies
Respected Advisor
Posts: 4,931

Re: How SAS got the result without class statement in Proc Logistic

Proc logistic doesn't require the response variable to be declared in a class statement. Check in the listing which level of your response variable was modelled (i.e. used as an event) in both cases. You can change which level is used as an event with EVENT= or DESCENDING options in the MODEL statement.

PG

PG
New Contributor byn
New Contributor
Posts: 4

Re: How SAS got the result without class statement in Proc Logistic

Programs with and without class statement use the same response variable and reference level. So, the different result is not related to the coding of response variable. I am still waiting for the answer.

Respected Advisor
Posts: 4,931

Re: How SAS got the result without class statement in Proc Logistic

Could you post the two pieces of code that give different estimates, as well as the format used?

PG
Solution
‎12-13-2013 10:46 PM
Super User
Posts: 19,860

Re: How SAS got the result without class statement in Proc Logistic

My guess....would be easy to test, but I'll assume you can do that Smiley Happy

Assuming the independent variable (IV) was a number, SAS treated it as a continuous variable.  If the values for the IV were not binary then the results would not be consistent between the two procedures.

New Contributor byn
New Contributor
Posts: 4

Re: How SAS got the result without class statement in Proc Logistic

Thank you PGStats and Reeza. I tested 10 situations.

I found out that even if the continuous independent variable is formatted to two categories, proc reg without class statement still uses the original continuous values.

Reeza is right.

Super User
Posts: 19,860

Re: How SAS got the result without class statement in Proc Logistic

Smiley Happy

Here's a link to some other gotcha's on using Logistic Regression in SAS:

Logistic Regression – Quick Tips | Statistics and other stuff from a geek

New Contributor byn
New Contributor
Posts: 4

Re: How SAS got the result without class statement in Proc Logistic

Thank you for your article. My concern is more related to how SAS treats the data with format.

After testing, I found out that continuous independent variable with two values 0 and 1 can produce the correct result. It is not necessary to use class statement to declare this variable is class variable.

But if the continuous variable has more than 2 values and format statement is used to classify the values of variable, class statement must be used.

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 7 replies
  • 270 views
  • 1 like
  • 3 in conversation