from (select flightnumber, date, boarded/passengercapacity*100 as pctfull format=4.1 label='Percent Full' from sasuser.marchflights)
from sasuser.flightschedule, (select flightnumber, date, boarded/passengercapacity*100 as pctfull format=4.1 label='Percent Full' from sasuser.marchflights)
from (select marchflights.flightnumber, marchflights.date, boarded/passengercapacity*100 as pctfull format=4.1 label='Percent Full', delay from sasuser.marchflights, sasuser.flightdelays where marchflights.flightnumber= flightdelays.flightnumber and marchflights.date= flightdelays.date)
f
has been added in the first FROM
clause to reference the table Sasuser.Flightschedule and the alias m
is associated with
the results from the in-line view. After the main FROM clause, a WHERE
clause that uses both of the aliases has been added. from sasuser.flightschedule as f,
(select flightnumber, date
boarded/passengercapacity*100
as pctfull
format=4.1 label='Percent Full'
from sasuser.marchflights) as m
where m.flightnumber=f.flightnumber
and m.date=f.date
proc sql; title "Flight Destinations and Delays"; select destination, average format=3.0 label='Average Delay', max format=3.0 label='Maximum Delay', late/(late+early) as prob format=5.2 label='Probability of Delay' from (select destination, avg(delay) as average, max(delay) as max, sum(delay > 0) as late, sum(delay <= 0) as early from sasuser.flightdelays group by destination) order by average;
delay > 0
.
For every value of Delay that is greater than 0, the Boolean expression
resolves to 1; values that are equal to or less than 0 resolve to
0. The SUM function adds all values of Delay to indicate the number
of delays that occurred for each destination.
group by destination
, specifying
that the in-line view data should be grouped, and summarized by the
values of Destination.
proc sql; title "Flight Destinations and Delays"; select destination, average format=3.0 label='Average Delay', max format=3.0 label='Maximum Delay', late/(late+early) as prob format=5.2 label='Probability of Delay' from (select destination, avg(delay) as average, max(delay) as max, sum(delay > 0) as late, sum(delay <= 0) as early from sasuser.flightdelays group by destination) order by average;
3.133.116.137