Hi, I am running proc logistic and I get the following error.
ERROR: All observations have the same response. No statistics are computed.
NOTE: The SAS System stopped processing this step because of errors.
How do I resolve this issue. Thank you.
The error is undoubtedly due to every observation in your data set containing a missing value in one or more of the variables you specified in your PROC LOGISTIC step. As mentioned, to see how many observations are omitted due to missing values on one or more variables involved in the model, list all variables specified in the modeling procedure (response, predictors, weight, freq, offset, and so on) in the VAR statement in the PROC MI step below. Note that you should never include any variables in the CLASS statement of PROC LOGISTIC that are not specified elsewhere in the procedure. The results include a table that shows each pattern of missing values found in the data and the number of observations with each pattern. In the table, X means a value is present, O or . means it is missing. Only those observations in Group 1, with no missing values in any variable, can be used.
proc mi data=<your_data> nimpute=0 displaypattern=nomeans;
class <all CLASS variables>;
var <all variables>;
fcs logistic;
ods select MissPattern;
run;
If the input data is constructed to only contain the variables specified in PROC LOGISTIC, then this code can be used.
proc mi data=<your_data> nimpute=0 displaypattern=nomeans;
class _character_;
var _all_;
fcs logistic;
ods select MissPattern;
run;
If all observations have the same response, it is impossible to fit any type of model to it. Your data is the problem, you cannot fit a logistic (or any other) regression model to this data.
Please show us the ENTIRE log for this PROC LOGISTIC.
Also, please show us part of the data so we can see that the response variable doesn't always have the exact same values. (A screen capture is fine, use the "insert photos" icon to include your screen capture in your reply; do not attach files)
Ok, when SAS says something is true, and the user says it is not true, I believe SAS.
It may be that once observations with missing X values are removed by PROC LOGISTIC, the error in the log becomes correct. Please look for that. Beyond that, I cannot help since I can't see your data.
proc freq data=;
table model readmit*pay1recat*age*totchg*readmitchg*aweekend*died *dispuniform*elective*female*los i10_ndx*i10_npr*pl_nchsrecat*zipinc_qrtl
*hosp_bedsize*h_contrl*hosp_urcat4recat*hosp_ur_teach*aprdrg_risk_mortality *aprdrg_severity / listwise out=check;
run;
Examine that output for any patterns or better yet, look at the missing pattern graphic/table from PROC MI.
https://blogs.sas.com/content/iml/2017/11/29/visualize-patterns-missing-values.html
If the outcome variable is named READMIT and your input dataset is named READMIT_ONLY then I think I can see why all of the outcomes have the same value.
The error is undoubtedly due to every observation in your data set containing a missing value in one or more of the variables you specified in your PROC LOGISTIC step. As mentioned, to see how many observations are omitted due to missing values on one or more variables involved in the model, list all variables specified in the modeling procedure (response, predictors, weight, freq, offset, and so on) in the VAR statement in the PROC MI step below. Note that you should never include any variables in the CLASS statement of PROC LOGISTIC that are not specified elsewhere in the procedure. The results include a table that shows each pattern of missing values found in the data and the number of observations with each pattern. In the table, X means a value is present, O or . means it is missing. Only those observations in Group 1, with no missing values in any variable, can be used.
proc mi data=<your_data> nimpute=0 displaypattern=nomeans;
class <all CLASS variables>;
var <all variables>;
fcs logistic;
ods select MissPattern;
run;
If the input data is constructed to only contain the variables specified in PROC LOGISTIC, then this code can be used.
proc mi data=<your_data> nimpute=0 displaypattern=nomeans;
class _character_;
var _all_;
fcs logistic;
ods select MissPattern;
run;
Thank you very much StatDave! I will apply the steps you suggested and revert. Thanks!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.