RESETTING SAS DEFAULT VALUES OF INDEPENDENT/DEPENDENT CATEGORICAL VARIABLES IN PROC LOGISTIC

RESETTING SAS DEFAULT VALUES OF INDEPENDENT/DEPENDENT CATEGORICAL VARIABLES IN PROC LOGISTIC

Logistic regression is used to predict the dependent binary variable using one or more independent variables. In the logit model the log odds of the outcome is modeled as a linear combination of the predictor variables. Logistic regression focuses instead, upon the relative probability (odds) of obtaining a given result category. We get the same odds ratio and significance level when we perform a 2 × 2 chi-square test and linear logistic regression for categorical variable.

SAS always takes default value as follows while performing logistic regression.

If the dependent variable is a binary variable with values 0 and 1, then SAS take the value 0 for modeling it, i.e., SAS takes the default value as minimum for it. But in the case of independent variable, SAS take the maximum value for comparing the classes of the same variable.

We can change these default values as follows.

By descending option we can change the default modeled value.
By ref = option, we can change the independent comparing value.
Ref= option specifies a value that we need to compare with other values
For making good results we must check the default outputs, or else our interpretation will be wrong.
This is an example to check the relationship between gender and smoking habits?

Description of the data

This data set has a binary response (outcome, dependent) variable called smoking status (yes=1 ,no=0). Gender is the only one independent variable here and we treat this variable as categorical. It takes values 1=male and 0=female.

If we are doing the logistic regression without changing default options we will get the following results.

Here is our logit model for this.

proc logistic data=smoking_data;

model smoking = gender;

run;

The first part of the above output gives the following

Here SAS modeled by taking the default value as 0.

Logistic model is only valid when we get a significant value.

logisticprocedure

Second part shows the following outputs

logisticprocedure

Here, if we want to put class wise comparison, we need to put the class statement before the model statements.

If we want to change the modeled value, we can put the descending option in proc statement. For e.g. here we use binary dependent variables as 0 and 1 so that SAS default takes the modeled value as 0. If we use descending option in the proc statement, then we get a modeled value as 1.

If we want to change the comparison value, then we can write this value in double quotes in the ref = option. This option can be written in the brackets of the class variable, so that we can compare it with other classes of the same variable. For example if we put ref = ”0” (0=female) in class sex statement then the smoking status of male will be predicted by comparing with the smoking status of females. If the variable is continuous then SAS default will compare the increasing order. For example if we put age as independent variable then the odds ratio will explain based on the increasing order.

proc logistic data=sympassv descending;

class sex(ref=”0″);

model smoking=sex;

run;

By putting the descending option we get the following results. Here the modeled value is changed from o to 1. If we use the values of dependent variable smoking category as 1 and 2 then SAS default will modeled it as 1, since we can understand that SAS always takes minimum value as default value for modeled value. If we use the values of independent categorical variable sex as 1 and 2 then SAS always compares default value as 2, which can also be changed by using ref=”1” option, thus we can compare the smoking status of female (2) using male (1). So from all these, we can understand, that for comparison, SAS takes maximum value in class variables as default.

logisticprocedure
logisticprocedure

Post A Comment

Protected by WP Anti Spam