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

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- How SAS got the result without class statement in ...

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2013 05:24 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2013 10:46 PM

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

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.

All Replies

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2013 05:56 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to PGStats

12-13-2013 06:07 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2013 09:01 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-13-2013 10:46 PM

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

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-14-2013 01:29 PM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

12-14-2013 07:02 PM

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

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Reeza

12-15-2013 11:36 AM

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.