A SERVICE OF

logo

248 Querying a DBMS Table Chapter 13
Output 13.6 Querying a DBMS Table with a WHERE clause
Flights to London and Frankfurt
DATES DEST
01MAR1998 FRA
04MAR1998 FRA
07MAR1998 FRA
03MAR1998 FRA
05MAR1998 FRA
02MAR1998 FRA
04MAR1998 LON
07MAR1998 LON
02MAR1998 LON
06MAR1998 LON
05MAR1998 LON
03MAR1998 LON
01MAR1998 LON
The next example uses the SQL procedure to query the DB2 table InterNat for
information on international flights with over 200 passengers. Note that output is sorted
by using a PROC SQL query and that the TITLE, LABEL, and FORMAT keywords are
not ANSI standard SQL; they are SAS extensions that you can use in PROC SQL.
libname mydblib db2 ssid=db2;
proc sql;
title ’International Flights by Flight Number’;
title2 ’with Over 200 Passengers’;
select flight label="Flight Number",
dates label="Departure Date"
format datetime9.,
dest label="Destination",
boarded label="Number Boarded"
from mydblib.internat
where boarded > 200
order by flight;
quit;
Output for this example is shown here.
Output 13.7 Querying a DBMS Table with SAS Extensions
International Flights by Flight Number
with Over 200 Passengers
Flight Departure Number
Number Date Destination Boarded
----------------------------------------
219 04MAR1998 LON 232
219 07MAR1998 LON 241
622 07MAR1998 FRA 210
622 01MAR1998 FRA 207