A SERVICE OF

logo

Accessing DBMS Data with the LIBNAME Statement Querying a DBMS Table 247
Output 13.5 Querying a DBMS Table
Total Salary by Jobcode
Total for
Jobcode Group
BCK $232,148.00
FA1 $253,433.00
FA2 $447,790.00
FA3 $230,537.00
ME1 $228,002.00
ME2 $498,076.00
ME3 $296,875.00
NA1 $210,161.00
NA2 $157,149.00
PT1 $543,264.00
PT2 $879,252.00
PT3 $21,009.00
SCP $128,162.00
TA1 $249,492.00
TA2 $671,499.00
TA3 $476,155.00
The next example uses the SQL procedure to query flight information from the
Oracle table Delay. The WHERE clause specifies that only flights to London and
Frankfurt are retrieved.
libname mydblib oracle user=testuser password=testpass;
title ’Flights to London and Frankfurt’;
proc sql;
select dates format=datetime9.,
dest from mydblib.delay
where (dest eq "FRA") or
(dest eq "LON")
order by dest;
quit;
Note: By default, both the WHERE clause and the ORDER BY clause are processed
by the DBMS for optimized performance. See “Overview of Optimizing Your SQL
Usage” on page 33 for more information.
Output for this example is shown here.