BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
KKIND
Obsidian | Level 7

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.

1 ACCEPTED SOLUTION

Accepted Solutions
StatDave
SAS Super FREQ

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;

View solution in original post

14 REPLIES 14
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
KKIND
Obsidian | Level 7
Hello and thank you for your reply. My data has several variables with different responses so I don't understand how this issue can crop up. When I am running the proc logistic program using the DV and the primary IV, it works. It is only when I add other covariates that this error happens.
PaigeMiller
Diamond | Level 26

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)

--
Paige Miller
KKIND
Obsidian | Level 7
Her you go. Thanks!

806 proc logistic data=NRD.nrd_2016_amirecat_readmit_only;
807 class aweekend (ref = "0") aprdrg_risk_mortality (ref = "1") aprdrg_severity (ref = "1") died (ref = "0") elective (ref = "0") female (ref =
807! "0") pay1recat (ref = "1") pl_NCHSrecat (ref = "1") zipinc_qrtl (ref = "1") hosp_bedsize (ref = "1") H_contrl (ref = "1") hosp_urcat4recat
807! (ref = "1") hosp_ur_teach (ref = "0") / param = ref;
808 model readmit
809 (event="1") = pay1recat age totchg readmitchg aweekend died dispuniform elective female los i10_ndx i10_npr pl_nchsrecat zipinc_qrtl
809! hosp_bedsize h_contrl hosp_urcat4recat hosp_ur_teach aprdrg_risk_mortality aprdrg_severity;
810 run;

ERROR: All observations have the same response. No statistics are computed.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: There were 313178 observations read from the data set NRD.NRD_2016_AMIRECAT_READMIT_ONLY.
NOTE: PROCEDURE LOGISTIC used (Total process time):
real time 0.27 seconds
cpu time 0.28 seconds

Sorry I cannot share any data as I am bound by the DUA I have signed with HCUP.
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
KKIND
Obsidian | Level 7
Okay, thank you PaigeMiller! Appreciate your time.
Reeza
Super User
Does your data have missing values? SAS removes missing values row wise, so if one variable has a missing value, that row is excluded from the analysis. One possibility is that either one variable is entirely missing or the combination of variables results in a single outcome. Run a proc freq of the data to see the combinations and outcomes with missing values.
KKIND
Obsidian | Level 7
Hi Reeza, YEs, my data does have missing values. When I run the proc freq, some categorical variables show 12,956 missing values while others show 13,192 missing values.
Reeza
Super User
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

 

 

KKIND
Obsidian | Level 7
Thank you very much Reeza! I will do as advised and revert.
Tom
Super User Tom
Super User

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.

KKIND
Obsidian | Level 7
Hello and thank you for your reply. My data has several variables with different responses so I don't understand how this issue can crop up. When I am running the proc logistic program using the DV and the primary IV, it works. It is only when I add other covariates that this error happens.
StatDave
SAS Super FREQ

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;
KKIND
Obsidian | Level 7

Thank you very much StatDave! I will apply the steps you suggested and revert. Thanks!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 14 replies
  • 1934 views
  • 12 likes
  • 5 in conversation