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

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!

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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

6 REPLIES 6
Rick_SAS
SAS Super FREQ

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

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
Rick_SAS
SAS Super FREQ

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=..."

 

 

lbogar314
Obsidian | Level 7

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?

Rick_SAS
SAS Super FREQ

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;

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is Bayesian Analysis?

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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