Examples of Data Transfer Services (DTS) |
Purpose |
Using SAS/CONNECT to connect to multiple servers, you can access data on several servers, combine that data on the client, and analyze the combined data. For example, if you have data that is stored under z/OS in a DB2 database and related data that is stored in an Oracle database under UNIX, you can use SAS/CONNECT in combination with SAS/ACCESS to combine that data on your client. This example uses salary and employee data gathered from two servers to illustrate the process.
Program |
This example signs on to two servers, downloads data from both servers, and performs analyses of the data on the client. The program uses the SIGNON and RSUBMIT statements.
Note: Bullets through apply to downloading both DB2 and Oracle data.
/*************************************/ /* connect to z/OS */ /*************************************/ 1 options comamid=tcp; filename rlink '!sasext0\connect\saslink\tcptso.scr'; signon zoshost; /*************************************/ /* download DB2 data views using */ /* SAS/ACCESS engine */ /*************************************/ 2 rsubmit zoshost; 3 libname db db2; 4 proc download data=db.employee out=db2dat; run; 5 endrsubmit; /*************************************/ /* connect to UNIX */ /*************************************/ 6 options remote=hrunix comamid=tcp; filename rlink '!sasext0\connect\saslink\tcpunix.scr'; signon; /*************************************/ /* download Oracle data using */ /* SAS/ACCESS engine */ /*************************************/ 2 rsubmit hrunix; 3 libname oracle user=scott password=tiger; 4 proc download data=oracle.employee out=oracdat; run; 5 endrsubmit; /*************************************/ /* sign off both links */ /*************************************/ 7 signoff hrunix; signoff zoshost cscript= '!sasext0\connect\saslink\tcptso.scr'; /*************************************/ /* join data into SAS view */ /*************************************/ 8 proc sql; create view joindat as select * from db2dat, oracdat where oracdat.emp=db2dat.emp; /*************************************/ /* create summary table */ /*************************************/ 9 proc tabulate data=joindat format=dollar14.2; class workdept sex; var salary; table workdept*(mean sum) all, salary*sex; title1 'Worldwide Inc. Salary Analysis by Departments'; title2 'Data Extracted from Corporate DB2 Database'; run; /* display graphics */ 10 proc gchart data=joindat; vbar workdept/type=sum sumvar=salary subgroup=sex ascending autoref width=6 ctext=cyan; pattern1 v=s c=cyan; pattern2 v=s c=magenta; format salary dollar14.; title1 h=5.5pct f=duplex c=white 'Worldwide Inc. Salary Analysis'; title2 h=4.75pct f=duplex c=white 'Data Extracted from Corporate DB2 Database'; run; quit;
Copyright © 2008 by SAS Institute Inc., Cary, NC, USA. All rights reserved.