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!
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;
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;
SAS Output






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=..."
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?
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;
Perfect, thank you so much!
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.