SAS Enterprise Guide

Desktop productivity for business analysts and programmers
BookmarkSubscribeRSS Feed
itchyeyeballs
Pyrite | Level 9

Hi All,

 

Can anyone help me with the syntax to execute a simple stored procedure within an EG process flow?

I've seen a guide here - https://amadeus.co.uk/sas-tips/executing-sql-stored-procedures-using-proc-sql/ but would rather not include the log in details in the code.

 

I can run procsql using syntax like:

 

proc sql;
create table SqlserverLibrary.table as
select * from desktop1.all;
quit;

 

But I can't seem to execute a simple stored procedure in the same way. There are no parameters, the procedure simply drops some temp tables and recreates them with updated versions.

 

Any help appreciated

4 REPLIES 4
LinusH
Tourmaline | Level 20

You need to do it in an explicit SQL pass through, by using either select * from connection to...() or execute () by...

There have been several posts about this on the communities, your should be able to find it by doing a serach.

Data never sleeps
itchyeyeballs
Pyrite | Level 9

Thank  you,

 

I always try searching before posting but didn't spot anything useful, guess I wasn't using right terms so will give it another go using your hints.

 

I've gotten it working now using :

 

PROC SQL;
	Connect to odbc (datasrc=dbdsn user = user password = password);
		Execute(db.stored_proc) by odbc;
	Disconnect from odbc;
QUIT;

but I really don't like having the username and password in plain text

 

however I've managed to find

proc pwencode

which gets around the issue

 

(I'd still prefer to use the server authentication as I do when connecting to a library though)

andystad
Calcite | Level 5

I am using the below code to execute a stored procedur but for the chanegs to show in the databse dont i need to commit them? if so can you do that from SAS?


proc sql;
connect to oracle (user='username' password=password path="path" );
execute (stored_proc) by oracle;
disconnect from oracle;
quit;

itchyeyeballs
Pyrite | Level 9

If your not using transactions you shouldn't need to commit (although may depend on settings)

 

Some info here - https://dba.stackexchange.com/questions/84769/commit-and-rollback-in-oracle-stored-procedure

 

 

 

 

sas-innovate-white.png

Special offer for SAS Communities members

Save $250 on SAS Innovate and get a free advance copy of the new SAS For Dummies book! Use the code "SASforDummies" to register. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 4 replies
  • 10058 views
  • 0 likes
  • 3 in conversation