BookmarkSubscribeRSS Feed
Fluorite | Level 6
Hello all,

Anyone know how to make a stored procedure call another stored procedure? This is without any forms of links.
The procedure completes then calls a second one based on the results.
Without calling a Stored Process via links, the type of processing you describe sounds more like SAS Macro facility conditional logic. Consider that I might have these 2 macro programs stored in a location accessible to the stored process server or the workspace server:
%main_task(something=, other=);

%cond_task(parm1=, parm2=);

It doesn't really matter what these 2 macro programs do. Now, let's imagine a third macro program that ALWAYS calls %MAIN_TASK and then conditionally calls %COND_TASK. Let's also imaging that %MAIN_TASK macro creates a macro variable called &SWITCH with a value of Y (to run %COND_TASK) or N (to bypass %COND_TASK):

%macro runmac;
%global SWITCH ;
** always run MAIN_TASK macro which sets global macro variable &SWITCH to Y or N;

%maintask(something=aaa, other=bbb);

** now, conditionally run %COND_TASK, which creates WORK.WOMBAT and print the dataset;
%if %upcase(&switch) = Y %then %do;

proc print data=work.wombat;
title "Printed because SWITCH=&switch";

%mend runmac;

Now, assuming that all 3 macro programs are in an AUTOCALL macro library, that is accessible to the servers, you could have a stored process like this:



There is a location under the LEV1 directory on your installation platform which is the location for SAS macro programs. If you put your macro programs there, you should be able to call them using %macpgm invocation syntax. See this note about AUTOCALL locations:

Also, see this previous post for some more information:

Fluorite | Level 6
This is actually for a web application used in the Information Delivery Portal.

I first trigger a stored procedure that collects the prompt values using the prompt wizard in EG. Once the user clicks RUN I want the stored process to display an html page stating the user inputs have been received and they will receive and email shortly with the report they requested.
This page would also trigger another stored process, in the background, that would generate the report and email it to the user.
Ah.... it is entirely do-able within the context of the IDP. If the HTML page that you create contains an HTML form, then the form <FORM> ACTION attribute can be a call to SASStoredProcess/do .... making a call to the SPWA (Stored Process Web App) to execute the second stored process.

Check the IDP samples for some FORM examples.




Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

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.

Get the $99 certification deal.jpg



Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 3 replies
  • 2 in conversation