How CONNECT TO STATEMENT Work in SAS

CONNECT TO STATEMENT in SAS is used when we want to connect database using explicit SQL pass-through let’s take an example using CONNECT TO STATEMENT to connect Teradata system.

 

PROC SQL ;
CONNECT TO TERADATA(USER=<USERID> PASSWORD="<PASSWORD>" SERVER=<SERVERNAME> DATABASE=<DATABASENAME>
CONNECTION=GLOBAL MODE=TERADATA);
CREATE TABLE DEMO AS SELECT * FROM CONNECTION TO TERADATA
(
SELECT
<COLUMNNAME>
FROM <TABLE NAME FROM DATABASE>
);
QUIT;

Here you have to replace the highlighted options with your environment i.e.

  1. <USERID> -> Teradata UserID
  2. <PASSWORD> -> Teradata Password
  3. <SERVERNAME> -> Teradata Server name
  4. <DATABASENAME> -> Database name registered in Teradata.
  5. <COLUMNNAME> ->Columns name seperated by comma you want to extract from table.
  6. <TABLE NAME FROM DATABASE> -> Table name which exist in teradata database.

Hope you are now more clear to CONNECT TO STATEMENT  in SAS feel free to comment if you have any query or error you’re while executing this code.

Happy Learning !!