Hello,
I am getting an error when running proc logistic as follows: All observations have the same response. No statistics are computed.
I know that my binary(0/1) response variable (bad) does NOT have the same value for observations in the data. I can't figure out why I am getting this error. The distribution of bads in the data is roughly 40% with value 1 and 60% with value 0. Any help is much appreciated. The code I am running is:
proc logistic data= train /*model_score_data(where=(selected=1))*/ descending /*outmodel=train_model*/;
model bad =
W_equipment
W_Ever_31Plus_DPD
W_TIB_Month
W_PG1_VantageScore
W_SBRI_Lease_Score
W_PG1_InquiriesDuringLast6Months
W_Months_Aged
/ selection=forward sle=0.1 ctable pprob=(0.1 to 0.5 by 0.05) lackfit
outroc=train_roc clodds=pl link=logit ;
weight weights;
output out=train_scored_data predicted=Pred_prob predprobs=individual
reschi=res_chi resdev=res_dev h=levrg difdev=dif_dev ;
*score data = model_score_data(where=(selected=0)) out=test_scored_data ;
run;
This error almost always occurs because missing or invalid values in the predictors, weights, or other variables involved in the model cause the exclusion of enough observations so that the remaining observations all have the same response level. Note that observations can be excluded as a result of having missing or invalid values in different variables, so checking each variable separately is not sufficient. So, one observation could be omitted because it has an invalid weight (zero or negative) and another could be omitted because it is missing on one predictor. Note that as more variables get added to the model during the model selection process, it is possible that more observations will be omitted.
This error almost always occurs because missing or invalid values in the predictors, weights, or other variables involved in the model cause the exclusion of enough observations so that the remaining observations all have the same response level. Note that observations can be excluded as a result of having missing or invalid values in different variables, so checking each variable separately is not sufficient. So, one observation could be omitted because it has an invalid weight (zero or negative) and another could be omitted because it is missing on one predictor. Note that as more variables get added to the model during the model selection process, it is possible that more observations will be omitted.
Thank you...this code is very helpful. The problem was I had missing weights.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.