13.07.2015 Views

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SAS/ACCESS 9.2 for Relational Databases: Reference, Fourth Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Accessing DBMS Data with the SQL Pass-Through Facility 4 Retrieving DBMS Data with a Pass-Through Query 869Output 30.1Data Retrieved by a Pass-Through QueryBrief Data <strong>for</strong> All InvoicesINVOICENUM NAME BILLEDON AMTINUS-------------------------------------------------------------------------------------------------------------11270 LABORATORIO DE PESQUI<strong>SAS</strong> VETERINARIAS DESIDERIO FINAMOR 05OCT1998 $2,256,870.0011271 LONE STAR STATE RESEARCH SUPPLIERS 05OCT1998 $11,063,836.0011273 TWENTY-FIRST CENTURY MATERIALS 06OCT1998 $252,148.5011276 SANTA CLARA VALLEY TECHNOLOGY SPECIALISTS 06OCT1998 $1,934,460.0011278 UNIVERSITY BIOMEDICAL MATERIALS 06OCT1998 $1,400,825.0011280 LABORATORIO DE PESQUI<strong>SAS</strong> VETERINARIAS DESIDERIO FINAMOR 07OCT1998 $2,256,870.0011282 TWENTY-FIRST CENTURY MATERIALS 07OCT1998 $252,148.5011285 INSTITUTO DE BIOLOGIA Y MEDICINA NUCLEAR 10OCT1998 $2,256,870.0011286 RESEARCH OUTFITTERS 10OCT1998 $11,063,836.0011287 GREAT LAKES LABORATORY EQUIPMENT MANUFACTURERS 11OCT1998 $252,148.5012051 LABORATORIO DE PESQUI<strong>SAS</strong> VETERINARIAS DESIDERIO FINAMOR 02NOV1998 $2,256,870.0012102 LONE STAR STATE RESEARCH SUPPLIERS 17NOV1998 $11,063,836.0012263 TWENTY-FIRST CENTURY MATERIALS 05DEC1998 $252,148.5012468 UNIVERSITY BIOMEDICAL MATERIALS 24DEC1998 $1,400,825.0012476 INSTITUTO DE BIOLOGIA Y MEDICINA NUCLEAR 24DEC1998 $2,256,870.0012478 GREAT LAKES LABORATORY EQUIPMENT MANUFACTURERS 24DEC1998 $252,148.5012471 LABORATORIO DE PESQUI<strong>SAS</strong> VETERINARIAS DESIDERIO FINAMOR 27DEC1998 $2,256,870.00The following example changes the Pass-Through query into an SQL view. It adds aCREATE VIEW statement to the query, removes the ORDER BY clause from theCONNECTION TO component, and adds the ORDER BY clause to a separate SELECTstatement that prints only the new SQL view. *libname samples ’your-<strong>SAS</strong>-data-library’;proc sql;connect to oracle as mydb (user=testuser password=testpass);%put &sqlxmsg;create view samples.brief asselect invnum, name, billedon <strong>for</strong>mat=datetime9.,amtinus <strong>for</strong>mat=dollar20.2from connection to mydb(select invnum, billedon, amtinus, namefrom invoices, customerswhere invoices.billedto=customers.customer);%put &sqlxmsg;disconnect from mydb;options ls=120 label;title ’Brief Data <strong>for</strong> All Invoices’;select * from samples.brie<strong>for</strong>der by billedon, invnum;quit;The output from the Samples.Brief view is the same as shown in Output 30.1.* If you have data that is usually sorted, it is more efficient to keep the ORDER BY clause in the Pass-Through query and letthe DBMS sort the data.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!