BookmarkSubscribeRSS Feed
IreneBisschop
Calcite | Level 5

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. 

 

8 REPLIES 8
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
IreneBisschop
Calcite | Level 5

I don't have any errors in my check1 file:

 
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 DATA check1;
74 SET mydata.dataset;
NOTE: Data file MYDATA.DATASET.DATA is in a format that is native to another host, or the file encoding does not match the session
encoding. Cross Environment Data Access will be used, which might require additional CPU resources and might reduce
performance.
75 lagid=lag(microchip_id);
76 lagresult=lag(result);
77 flag=0;
78 IF microchip_id = lagid AND lagresult=0 THEN flag=1;
79 IF age='Cub' THEN age= 'Juvenile';
80 RUN;
 
NOTE: There were 1758 observations read from the data set MYDATA.DATASET.
NOTE: The data set WORK.CHECK1 has 1758 observations and 99 variables.
NOTE: DATA statement used (Total process time):
real time 0.07 seconds
cpu time 0.04 seconds
 
 
81
82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
95
 

 

PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
FreelanceReinh
Jade | Level 19

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;
IreneBisschop
Calcite | Level 5

Hi,

 

This is what I get when I run this code

 
Table of Contents

The FREQ Procedure

 result Frequency Percent CumulativeFrequency CumulativePercent0
386100.00386100.00

 

PaigeMiller
Diamond | Level 26

So of course, SAS is right, you have the same response for all observations.

--
Paige Miller
Kurt_Bremser
Super User

@IreneBisschop wrote:

Hi,

 

This is what I get when I run this code

 
Table of Contents

The FREQ Procedure

 result Frequency Percent CumulativeFrequency CumulativePercent0
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.

FreelanceReinh
Jade | Level 19

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 8 replies
  • 2087 views
  • 0 likes
  • 4 in conversation