BookmarkSubscribeRSS Feed
az123
Calcite | Level 5

Hi,

 

Does SAS support any way to execute an external SQL script?  

 

I have a dozen scripts, with 100's of statements that would require me to wrap each statement with EXECUTE( ) BY TERA to use with pass-through facility.  I'm open to suggestions for ways I can use SAS to execute the scripts.

3 REPLIES 3
PGStats
Opal | Level 21

You could build the code as text, then run it

 

filename terasql temp;

data _null_;
length sqlStatement $2000;
infile ...;
input...;
/* Build SQL code here into */
file terasql;
put sqlStatement;
run;

proc sql;
connect to ...;
%include terasql; 
quit;
PG
Tom
Super User Tom
Super User

Why not just ask the operating system to use BTEQ to run the script for you?

You can use the PIPE engine or one of the many commands that SAS has for running operating system commands.

 

LinusH
Tourmaline | Level 20
Just throwing an idea (I don't have access right so untested).
Perhaps a macro that holds the connect to stuff, and %include to your SQL script file (name pramterized and specified in the macro call).
As @Tom I would like to know the reason for driving this through SAS.
Data never sleeps

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