Open In App

How to Connect Teradata Using SAS in SQL?

Last Updated : 08 Feb, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

SAS is a popular statistical software that provides a powerful suite of tools for data management, analytics, and reporting. In this blog post, we will show you how to connect to Teradata using SAS in SQL. Teradata is a high-performance, relational database management system that is widely used for data warehousing and business intelligence applications.

Install the Teradata ODBC Driver

The first step to connecting to Teradata using SAS is to install the Teradata ODBC driver. This driver provides a bridge between SAS and Teradata, allowing you to access Teradata data from SAS. You can download the Teradata ODBC driver from the Teradata website. Follow the instructions on the website to install the driver on your computer.

Create a System Data Source Name (DSN)

Once the Teradata ODBC driver is installed, you need to create a System Data Source Name (DSN). A DSN is a database connection profile that contains all the information SAS needs to connect to a Teradata database. To create a DSN, follow these steps:

  • Go to Start > Control Panel > Administrative Tools > Data Sources (ODBC).
  • Click the System DSN tab.
  • Click the Add button to create a new DSN.
  • Select the Teradata ODBC Driver and click Finish.
  • In the Teradata ODBC Driver Setup window, enter a name for the DSN in the Data Source Name field.
  • Enter the Teradata database server name or IP address in the Host field.
  • Enter your Teradata username and password in the User ID and Password fields.
  • Click OK to save the DSN.

Connect to Teradata in SAS

With the Teradata ODBC driver installed and the DSN created, you are now ready to connect to Teradata in SAS. To do this, follow these steps:

1. Launch SAS and open a new program.
2. Type the following code to connect to Teradata using the ODBC connection.

libname tera odbc datasrc=tera_dsn;

Replace “tera_dsn” with the name of the DSN you created.

1. Run the code by clicking the Run button or pressing F9. SAS will now connect to the Teradata database and assign it the name “tera”.

Query Teradata Data in SAS

With the connection to Teradata established, you can now query Teradata data in SAS. To do this, simply use the SAS SQL procedure to issue SQL statements against the Teradata database. For example, to query the “customers” table in Teradata, you would use the following code:

proc sql;
select * from tera.customers;
quit;

This code uses the SAS SQL procedure to query the “customers” table in the Teradata database and return the results to SAS.

In conclusion, connecting to Teradata using SAS in SQL is a straightforward process that requires a few simple steps. With the Teradata ODBC driver installed and a DSN created, you can use SAS to query Teradata data and perform data analysis, reporting, and more. Whether you are a data analyst, data scientist, or business intelligence professional, Teradata, and SAS provide a powerful combination for managing and analyzing large amounts of data.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads