postgreSQL how can I make this work with an aggregation alias? postgreSQL 9.5.6

How can I make this work using the percent_error alias?

SELECT time::date, 
  sum((status='404 NOT FOUND')::int) as not_found,
  sum((status='200 OK' OR status='404 NOT FOUND')::int) as total,
  sum((status='404 NOT FOUND')::int)/sum((status='200 OK' OR status='404 NOT FOUND')::int)::float as percent_error
  from log
  group by time::date
  having sum((status='404 NOT FOUND')::int)/sum((status='200 OK' OR status='404 NOT FOUND')::int)::float &gt; 0.01;


A query like this work:

select species, 
  count(*) as num 
  from animals 
  group by species 
  having num=1;


But not this - exactly the same as the first example above except here the last line is using percent_error alias:

SELECT time::date, 
  sum((status='404 NOT FOUND')::int) as not_found,
  sum((status='200 OK' OR status='404 NOT FOUND')::int) as total,
  sum((status='404 NOT FOUND')::int)/sum((status='200 OK' OR status='404 NOT FOUND')::int)::float as percent_error
  from log
  group by time::date
  having percent_error &gt; 0.01;
A "WITH query" (CTE) may be useful for you (see: https://www.postgresql.org/docs/current/static/queries-with.html - read at least the first paragraph ...) 

Here's an example, very close to your situation.  Notice: date_ is the equivalent of time::date in your code:

with stats as (
  select
    date_ 
  , sum((status='404 NOT FOUND')::int) as not_found
  , sum((status='200 OK' OR status='404 NOT FOUND')::int) as total
  , sum( (status='404 NOT FOUND')::int) / 
         sum((status='200 OK' OR status='404 NOT FOUND')::int)::float  
    as percent_error
  from log
  group by date_
)
select not_found, total, percent_error
from stats
where percent_error &gt; 0.01 ;