SAS- Connecting and Getting SAS datasets directly from oracle

What do you need?

     1. A machine which has an oracle client or the capability to connect to an oracle server.
     2. Details required – User Name, Password and the host name.
     3. Proper version of SAS installed having the necessary oracle drivers.Read SAS modules to check.

SAS Code:
Say you have a table name “employee” in your oracle server which you used to connect using the user “scott”, password “tiger” and path being “emp1”. Requirement is to get all the records from the table as a local dataset.

libname test “D:\Temp\”;
proc sql;
connect to oracle(user=scott orapw=tiger path=”@emp1″);
create table test.employee as select * from connection to oracle
(select * from employee);
disconnect from oracle;
Employee dataset will be created in the library specified. The formats of the variables in the new dataset will be same/equivalent to the one in oracle (The database from which it was created).

Blog Widget by LinkWithin

Search this blog..