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.

<strong>SAS</strong>/<strong>ACCESS</strong> Interface to Oracle 4 Date, Timestamp, and Interval Data 733c_ts=’.’dt; k=2; output;<strong>for</strong>mat c_ts datetime23.2; run;/* picks default TIMESTAMP type */options sastrace=",,,d" sastraceloc=saslog nostsuffix;data ora.tab_tsfsec; set work.sasdsfsec; run;options sastrace=",,," sastraceloc=saslog nostsuffix;proc delete data=ora.tab_tsfsec; run;/* Override the default datatype */options sastrace=",,,d" sastraceloc=saslog nostsuffix;data ora.tab_tsfsec (dbtype=(c_ts=’timestamp(3)’));c_ts=’30sep1998:14:00:35’dt;<strong>for</strong>mat c_ts datetime23.; run;options sastrace=",,," sastraceloc=saslog nostsuffix;proc delete data=ora.tab_tsfsec; run;proc print data=ora.tab_tsfsec; run;/* OUTPUT: Brand new table creation with bulkload=yes */title2 ’Test OUTPUT with bulkloader’;proc delete data=ora.tab_tsfsec; run;/* picks default TIMESTAMP type */data ora.tab_tsfsec (bulkload=yes); set work.sasdsfsec; run;proc print data=ora.tab_tsfsec; run;Here is an INTERVAL YEAR TO MONTH example.proc sql;connect to oracle ( &PTCONN);execute ( drop table PRODUCT_INFO) by oracle;execute (create table PRODUCT_INFO ( PRODUCT VARCHAR2(20), LIST_PRICE number(8,2),WARRANTY_PERIOD INTERVAL YEAR(2) TO MONTH ))by oracle;execute (insert into PRODUCT_INFO values (’Dish Washer’, 4000, ’02-00’))by Oracle;execute (insert into PRODUCT_INFO values (’TV’, 6000, ’03-06’))by Oracle;quit;proc contents data=ora.PRODUCT_INFO; run;/* Shows WARRANTY_PERIOD as number of months */proc print data=ora.PRODUCT_INFO; run;/* Shows WARRANTY_PERIOD in a <strong>for</strong>mat just like in Oracle*/proc print data=ora.PRODUCT_INFO(dbsastype=(WARRANTY_PERIOD=’CHAR(6)’)); run;/* Add a new product */data new_prods;

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

Saved successfully!

Ooh no, something went wrong!