Help using Base SAS procedures

PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 7
Accepted Solution

PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

I am at a complete loss as to why I am getting this error...

 

My code looks like this:

 

proc logistic data = dataset;

by variable1 variable2;

model response = variable3;

roc "variable3" variable3

run;

 

The dataset is sorted on the variables in the by statement and no errors are given except for the 'All observations have the same response. No statistics are computed.'  for one combination for variable1 and variable2.  There are no missing variables and there is a 90/10 split between 0s and 1s for the response variable.  I get the output I need but have no idea why I get this error for just one combination of variable1 and variable2.  Any help would be greatly appreciated!  Thanks in advance!


Accepted Solutions
Solution
‎05-17-2018 03:30 PM
SAS Super FREQ
Posts: 4,242

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Posted in reply to lbogar314

Mostly (1).  Missing values in the BY variables shouldn't be a problem.

 

That message indicates that the responses for the nonmissing observations are all the same value.

That's why I asked you to check NMISS for the explanatory variable. For example, the following data sets each give the message:

 

data Have;
do i = 1 to 10;
   x = rand("Normal");
   y = 1;  /* all Y's are 1 */
end;
run;

proc logistic data=Have;
model y = x;
run;

data HaveMiss;
input x y @@;
datalines;
2 1   3 1   . 0   4 1   . 0  
2 1   4 1   2 1   . 0   5 1
;

proc logistic data=HaveMiss;
model y = x;
run;

 

View solution in original post


All Replies
SAS Super FREQ
Posts: 4,242

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Posted in reply to lbogar314

I suspect the answer will be revealed if you run the following code and substitute in the values of the BY group that is giving the error. Post the result.

proc means data = dataset N NMISS MAX MIN MEAN STD;
where variable1=VAL1 and variable2=VAL2;
/* or for character:  where variable1="VAL1" and variable2="VAL2"; */
var response variable3;
run;
Occasional Contributor
Posts: 7

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

SAS Output

Variable N N Miss Maximum Minimum Mean Std Dev
438
438
0
0
1.0000000
1362.00
0
-218.0000000
0.8904110
737.7214612
0.3127340
224.5709360
SAS Super FREQ
Posts: 4,242

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Posted in reply to lbogar314

I don't understand how those statistics could lead to the error you report. Could you please:

 

1. Paste in the portion of the SAS log that shows the submitted code

2. Paste in the portion of the code that gives the error, along with the NOTE that says "The previous error was for the BY group where Variable1=... and Variable2=..."

 

 

Occasional Contributor
Posts: 7

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

That's what I thought.  I just ran it now though and it's working so I am not sure where I went wrong previously or if I misread the log (my apologies!).  Either way though- thank you so much for your quick response!  I really appreciate it.  And for future reference this error would happen if I 1. I had responses that were all the same (either all 1s or all 0s) or 2. Had missing data for one of the by variables??  Is that correct?

Solution
‎05-17-2018 03:30 PM
SAS Super FREQ
Posts: 4,242

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Posted in reply to lbogar314

Mostly (1).  Missing values in the BY variables shouldn't be a problem.

 

That message indicates that the responses for the nonmissing observations are all the same value.

That's why I asked you to check NMISS for the explanatory variable. For example, the following data sets each give the message:

 

data Have;
do i = 1 to 10;
   x = rand("Normal");
   y = 1;  /* all Y's are 1 */
end;
run;

proc logistic data=Have;
model y = x;
run;

data HaveMiss;
input x y @@;
datalines;
2 1   3 1   . 0   4 1   . 0  
2 1   4 1   2 1   . 0   5 1
;

proc logistic data=HaveMiss;
model y = x;
run;

 

Occasional Contributor
Posts: 7

Re: PROC LOGISTIC ERROR: All observations have the same response. No statistics are computed.

Perfect, thank you so much!

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 292 views
  • 0 likes
  • 2 in conversation