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 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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