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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

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

7 REPLIES 7
PGStats
Opal | Level 21

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
byn
Calcite | Level 5 byn
Calcite | Level 5

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.

PGStats
Opal | Level 21

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

PG
Reeza
Super User

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.

byn
Calcite | Level 5 byn
Calcite | Level 5

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.

byn
Calcite | Level 5 byn
Calcite | Level 5

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.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

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
  • 7 replies
  • 969 views
  • 1 like
  • 3 in conversation