Hi,
I'm getting the following message All observations have the same response. No statistics are computed. when I run the following code:
PROC SORT DATA=mydata.dataset;
by microchip_id;
run;
DATA check1;
SET mydata.dataset;
lagid=lag(microchip_id);
lagresult=lag(result);
flag=0;
IF microchip_id = lagid AND lagresult=0 THEN flag=1;
IF age='Cub' THEN age= 'Juvenile';
RUN;
PROC LOGISTIC DATA=check1;
CLASS zone (REF='C') sweep (REF='8') age (REF='Juvenile') sex (REF='M') /PARAM=REF;
MODEL result (REF='0')=zone;
WHERE flag EQ 1 ;
RUN;
It used to work but now it suddenly stopped working. Does anyone has any idea? I do have one missing value, but if I delete that value, the same error occurs.
Thanks in advance.
ERROR: All observations have the same response. No statistics are computed.
I would think the best solution is for YOU to look at the data set CHECK1 and see what is happening. Since we don't have the data, there's really very little we can do to help you.
I don't have any errors in my check1 file:
This is not the same as actually LOOKING at the data set CHECK1, preferably using a SAS data set viewer, or less preferred using PROC PRINT.
The "errors" in your check1 file are probably not tagged as such, but they should become apparent if you run the following step:
proc freq data=check1;
tables result;
where flag=1 and cmiss(zone, sweep, age, sex)=0;
run;
Hi,
This is what I get when I run this code
The FREQ Procedure
386 | 100.00 | 386 | 100.00 |
So of course, SAS is right, you have the same response for all observations.
@IreneBisschop wrote:
Hi,
This is what I get when I run this code
Table of Contentsresult Frequency Percent CumulativeFrequency CumulativePercent0The FREQ Procedure
386 100.00 386 100.00
Which means that all observations going into proc logistic have the same result, and therefore the statistics would be meaningless.
So you need to go back one step and inspect your dataset mydata.dataset used in
DATA check1;
SET mydata.dataset;
lagid=lag(microchip_id);
lagresult=lag(result);
flag=0;
IF microchip_id = lagid AND lagresult=0 THEN flag=1;
IF age='Cub' THEN age= 'Juvenile';
RUN;
and compare it with previous versions.
Moreover, the WHERE condition (in the PROC FREQ step) seems to have reduced the number of usable observations for PROC LOGISTIC from 1758 to only 386. Possibly, missing values in variables SWEEP, AGE or SEX have contributed to this reduction. These three variables are used in the CLASS statement, but not necessarily so, as they're not part of the MODEL statement.
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.