## Pages

### Learn Proc Logistic in SAS This article has been written in continuation of our previous article "Logistic Regression - Part 1 - Theory". Please go though the Part 1, before this. This article covers the "How to do" part of Logistic Regression and SAS code explanation.

Also, we strongly recommend to go through the Linear Regression modeling technique before Logistic Regression. As most of the step remain same. We have explained step in much more details in Linear Regression related articles.

As in,

1. First we need to understand the business, model objective and dependent variable
2.  Brainstorm and list down variables that might be affecting the dependent variables
3.  Collect data and clean it
4. Then prepare the master data in which you keep all the Y and X1,X2,X3 .... Xn variables.

Now, while going for modeling, we can go for two approaches :

1. Using x variables as such

2. Transforming continuous x variables to categorical variables manually as per business understanding

3.  WOE and IV approach

Post selecting the approach start  modeling.

Step 1

Break the the finalized data into two parts :

Data a.Training a.validation;
set a.Model_master;
if ranuni(2) < 0.7 then output a.Training;
else output a.validation;
Run;

Step 2

Run Proc Logistic :

Proc Logistic data = a.Training descending;
Model response = X1 X2 X3
/ selection = stepwise  sle = 0.04  sls = 0.05
lackfit  ctable  pprob= ( 0 to 1 by 0.1)
outroc = a.roc_data;
output out = a.result p = probability_of_1;
score data = a.validation out = a.validation
outroc = a.roc_data_v ;
Run
Quit;

Let's understand the

Selection methods have bee explained in  Linear Regression article in details, their functioning remains same in Logistic Regression.

Next part would cover : Result interpretation of Logistic Regression in SAS