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 LIBNAME Statement 4 Selecting and Combining DBMS Data 865libname mydblib db2 ssid=db2;proc freq data=mydblib.invoices(keep=invnum country);tables country;title ’Invoice Frequency by Country’;run;The following output shows the one-way frequency table that this example generates.Output 2<strong>9.2</strong>0Using the FREQ ProcedureInvoice Frequency by Country 1The FREQ ProcedureCOUNTRYCumulative CumulativeCOUNTRY Frequency Percent Frequency Percent-------------------------------------------------------------------------Argentina 2 11.76 2 11.76Australia 1 5.88 3 17.65Brazil 4 23.53 7 41.18USA 10 58.82 17 100.00Selecting and Combining DBMS DataThis example uses a WHERE statement in a DATA step to create a list that includesonly unpaid bills over $300,000.libname mydblib oracle user=testuser password=testpass;proc sql;create view allinv asselect paidon, billedon, invnum, amtinus, billedtofrom mydblib.invoicesquit;data notpaid (keep=invnum billedto amtinus billedon);set allinv;where paidon is missing and amtinus>=300000.00;run;proc print data=notpaid label;<strong>for</strong>mat amtinus dollar20.2 billedon datetime9.;label amtinus=amountinus billedon=billedoninvnum=invoicenum billedto=billedto;title ’High Bills--Not Paid’;run;

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

Saved successfully!

Ooh no, something went wrong!