connecting sas to a
play

CONNECTING SAS TO A TERADATA SERVER KEVIN MARK DATA SCIENTIST, - PowerPoint PPT Presentation

CONNECTING SAS TO A TERADATA SERVER KEVIN MARK DATA SCIENTIST, GROUP COLLECTIONS WEDNESDAY 25 OCTOBER 2017 Westpac Banking Corporation ABN 33 007 457 141. Problem of data not in SAS format Enterprise Guide GOAL: Bring the data stored on the


  1. CONNECTING SAS TO A TERADATA SERVER KEVIN MARK DATA SCIENTIST, GROUP COLLECTIONS WEDNESDAY 25 OCTOBER 2017 Westpac Banking Corporation ABN 33 007 457 141.

  2. Problem of data not in SAS format Enterprise Guide GOAL: Bring the data stored on the Teradata server into a SAS session. Images from http://www.teradata.com/Resources/Videos/Enabling-in-database-processing-with-SAS-ACCE and http://www.teradata.com/Solutions-and-Industries/sas-optimization/ 2 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  3. Overview Connecting SAS with Teradata Two interfaces to connect SAS with Teradata Concealing your Teradata password Importing Teradata data to SAS Joining a small SAS dataset with Teradata data Questions Disclaimer: The presentation are the views of the presenter and not that of the Westpac Group. 3 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  4. CONNECTING SAS WITH TERADATA Two interfaces

  5. Two interfaces to connect SAS with Teradata SAS/Access Interface to ODBC SAS EG running with a Profile connected to a SAS/Access Interface to Teradata SAS Unix Server UNIX SERVER Images from http://www.teradata.com/Resources/Videos/Enabling-in-database-processing-with-SAS-ACCE and http://www.teradata.com/Solutions-and-Industries/sas-optimization/ 5 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  6. Battle of the Interfaces Access Interface to ODBC Access Interface to Teradata Connects from local PC Server Connects from SAS Unix Server • Requires SAS EG to be connected to SAS Unix Server Implicit connection via a libname Implicit connection via a libname statement statement Explicit connection via an ODBC Explicit connection via a Teradata connection in a SQL procedure connection in a SQL procedure Ability to execute Teradata commands from SAS • Including ability to create and use temporary (volatile) tables. 6 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  7. CONCEALING YOUR PASSWORD

  8. Concealing your Teradata password Situation Example SAS Code: proc pwencode in=‘ my_password ’; User names and passwords to a Teradata server need to be specified in SAS code. run; We want to write, save and run code without The SAS Log outputs the following: divulging passwords, especially in LOGs. {sas002} DBCC5712369DE1C65B19864C1564FB850F39 8DCF The PWENCODE Procedure will encrypt a password which you can use. Not perfect. See SAS Documentation on the procedure for how to use this securely. %let password={sas002} DBCC5712369DE1C65B19864C1564FB850F39 8DCF; 8 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  9. IMPORTING TERADATA DATA TO SAS

  10. Importing Teradata data to SAS Database=DB1 Table=Employees Columns: employee_id , date,… SAS/Access Interface to ODBC ODBC Data Source Name dsn =“ TD_Server ” GOAL: Create the SAS dataset Emps_Today of today’s employees with all SAS/Access Interface to Teradata available columns. Teradata Server Address UNIX SERVER tdpid =“12.34.567.89” Images from http://www.teradata.com/Resources/Videos/Enabling-in-database-processing-with-SAS-ACCE and http://www.teradata.com/Solutions-and-Industries/sas-optimization/ 10 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  11. Implicit connection via a libname statement Access Interface to ODBC Access Interface to Teradata libname TD_DB1 libname TD_DB1 odbc teradata dsn =“ TD_Server ” tdpid =“12.34.567.89” user=“user - id” user=“user - id” password=“&password.” password=“&password.” schema =“DB1”; database =“DB1”; data work.Emps_Today; data work.Emps_Today; set TD_DB1.Employees; set TD_DB1.Employees; where date=‘25OCT2017’d; where date=‘25OCT2017’d; run; run; 11 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  12. Explicit connection via a SQL Procedure Access Interface to ODBC Access Interface to Teradata proc sql; proc sql; connect to ODBC ( connect to teradata ( dsn =“ TD_Server ” tdpid =“12.34.567.89” user=“user - id” user=“user - id” password=“&password.”); password=“&password.”); create table work.Emps_Today as create table work.Emps_Today as select * from connection to ODBC select * from connection to teradata (select * from DB1.Employees (select * from DB1.Employees where date=date ‘2017 -10- 25’ ); where date=date ‘2017 -10- 25’ ); quit; quit; 12 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  13. JOINING A SMALL SAS DATASET WITH TERADATA DATA

  14. SAS Dataset=EMPS_Output Columns: employee_id, date ,… Has only 100 rows. Database=DB1 Table=Employees Columns: employee_id , date,… Has millions of rows Join data in Teradata SAS Dataset=EMPS Columns: employee_id, date Create a temporary (volatile) Has only 100 rows. Upload SAS table in Teradata called Dataset to EMPS_TEMP Teradata Images from http://www.teradata.com/Resources/Videos/Enabling-in-database-processing-with-SAS-ACCE and http://www.teradata.com/Solutions-and-Industries/sas-optimization/ 14 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  15. Joining a small SAS dataset with Teradata data Connect globally to temporary Teradata Create a volatile table EMPS_TEMP libname temp teradata execute( tdpid =“12.34.567.89” create multiset volatile table EMPS_TEMP ( user=“user - id” employee_id VARCHAR(10) password=“&password.” date DATE) connection=GLOBAL primary index (employee_id) dbmstemp=YES; on commit preserve rows; proc sql; ) by teradata; connect to teradata ( tdpid =“12.34.567.89” execute (commit work) by teradata; user=“user - id” quit; password=“&password.” connection=GLOBAL); 15 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  16. Joining a small SAS dataset with Teradata data Upload SAS data to a Teradata volatile table proc append base=temp.EMPS_TEMP (MULTISTMT=yes) data=EMPS (keep=employee_id date); run; 16 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  17. Joining a small SAS dataset with Teradata data Create the resultant SAS dataset with … …an explicit Teradata SQL select statement proc sql; select connect to teradata ( b.* tdpid =“12.34.567.89” from EMPS_TEMP a user=“user - id” inner join Employees b password=“&password.” on b.employee_id=a.employee_id and b.date=a.date connection=GLOBAL); create table work.EMPS_OUTPUT as select * from connection to teradata ); ( quit; 17 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

  18. Thank you and Questions kevin.mark@westpac.com.au 18 | Connecting SAS to a Teradata server has more than 12 series‘ you will need to manually colour the additional series.

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend