Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- Re: Proc Logistic error: "All observations have the same response. No...

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-06-2013 07:09 PM
(19362 views)

Hi,

I ran a logistic regression on my dataset and got the following error:

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

Could it be so because I am modeling rare events? (~175 events out of 200,000+ observations)

Thanks for any advice

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

9 REPLIES 9

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Yes, but more specifically I'd guess that there is some classification variable for which all the Y=1 belong to a single category. For example, if you are using CLASS GENDER, maybe all of the Y=1 values are male.

Try using PROC FREQ to cross tabulate Y with your classification varialbles. You might see an empty cell. That would indicate that you cannot use that classification variable as an explanatory variable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Rick,

Thanks for the answer. I did not use any classification but instead, used proc logistic on my whole dataset. So there should not be a situation where there are all Y=1 or Y=0. That's also why I was confused that I got such an error.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Do you have a WHERE clause or other DATA= option that is filtering data? Or a format that coalesces values of an explanatory variable?

What does your MODEL statement look like?

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Rick,

My model is really simple. My code is:

proc sort data=fun;

by id year quarter;

run;

proc logistic data=fun descending;

model flag= var1 var2 var3 var4 var5 var6 var7 var8 var9 var10 var11 var12;

output out=propensity_scores pred=prob_flag;

run;

I'm not sure where any filtering or coalescing may have occurred.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hmm, interesting. And what do you get from running the following?

proc freq data=fun; tables flag; run;

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Rick,

I get the following output:

Cumulative Cumulative

Flag Frequency Percent Frequency Percent

ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

0 252784 99.93 252784 99.93

1 174 0.07 252958 100.00

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi Bobderr,

Thanks for your advice. It seems that this is indeed the reason. When I removed some of the independent variables, the regression worked!

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

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.