BookmarkSubscribeRSS Feed
Shukhrat
Fluorite | Level 6

Hello.
I recently started learning programming in sas.
Who can tell you how to create a permanent symbolic link?
When performing any tasks, I often turn to the database with an sql query, which should be executed in the database server and return the result to me.

This is how I do it:

 

proc sql;
connect to oracle (AuthDomain = "Oracle_Auth" PATH = "@ dev-db.sas.ru:1521/SASDEV");
select * from cdm.ci_campaign;
disconnect from oracle;
quit;

 

Here's how I would like to simplify it:

proc sql;
&connectORA.;
select * from cdm.ci_campaign;
disconnect from oracle;
quit;
1 REPLY 1
Kurt_Bremser
Super User

Put your connection information into a macro:

%macro connectORA;
connect to oracle (AuthDomain = "Oracle_Auth" PATH = "@ dev-db.sas.ru:1521/SASDEV");
%mend;

and call it in your SQL:

proc sql;
%connectORA;
select * from connection to oracle (select * from cdm.ci_campaign);
disconnect from oracle;
quit;

I your example, no CONNECT and DISCONNECT would be needed, as the SELECT works directly from a SAS library (which might be defined as a connection to Oracle on its own). But I guess that CDM is in fact a schema in the Oracle database, and not available in the SAS environment on its own.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 274 views
  • 0 likes
  • 2 in conversation