Titanic Kaggle Solution using SAS

titanic
sas
kaggle

#1

I used logistic regression (stepwise selection) using SAS for solving the Titanic problem listed in Kaggle.
I have got stuck in the model fitting part as I am getting errors. I think its because sex is binary variable in my dataset. This was the code I used for fitting the model

data titanic.test;
set titanic.test;
survived=2.3252 -1.1281*Pclass-2.7404*sex-0.0363*Age-0.3621*SibpSp;
predicted=exp(survived)/(1+exp(survived));
run;

Please suggest a correct/better way to do this.


#2

@Prachi

Can you post the error as well? Preferably a screenshot of it.

Regards,
Kunal


#3

I am getting error in the sense that the code is running but I am getting missing values. I am attaching screenshots of both log and result. Log:


#4

Here is a screenshot of the result-


#5

@Prachi,

In your equation, you have used variable SibpSp and as I can see in the snapshot, it has missing values (period). As you know that when you perform mathematical calculation with period, it returns a missing value.

data titanic.test;
set titanic.test;
survived=2.3252 -1.1281Pclass-2.7404sex-0.0363*Age-0.3621 * SibpSp;
predicted=exp(survived)/(1+exp(survived));
run;

You can use variable SibSp or solve for missing value of SibpSP.

Hope this helps!

Regards,
Sunil


#6

It was a silly mistake on my part…thank u so much!