BookmarkSubscribeRSS Feed
Not applicable
I am converting a program from a language called FOCUS to an eventual EG Stored Process. The current program has a lot of parameters that must be entered before executing.

My question: Can a stored process have more than one screen of parameters? If so, how would that be done?

Second question: Can a stored process call another stored process?
When you define the parameters, you have the option to set parameter groups in EG -- each parameter group gets it's own "tab" in the interface in EG and MS Office. So if you consider each "tab" to be like a screen, then you don't have to worry about coding the screens -- just make logical parameter groups and put parameters into them. In EG you can make the parameters and then make the groups and drag and drop the parameters into groups. In SAS Mgt Console, you have to define the groups first and then place the parameters in the right group when you click to create it.

I would not try to have a stored process call another stored process. If I had code that needed to be executed conditionally, I would put the conditional code into macro programs that lived in an AUTOCALL library.

So let's assume that I have some weekly report code and some daily report code and based on a parameter value in the SP, the users can choose whether to run the weekly report or the daily report. I can make a macro program (a black box right now) called %weekly; for the weekly report and %daily; for the daily report -- and in my main SP, I'm going to define a parameter called REPTYPE that will allow them to select either WEEKLY or DAILY

Assuming that those macro programs are stored in the AUTOCALL macro location that my BI Platform installation knows about, then I can do this in my SP:
**** start of SP program code -- call this DOREPT.SAS;
**** register as DOREPT stored process with 1 parameter REPTYPE;
**** Output type is STREAMING;

%global reptype;

libname mylib .....;

%macro testparm;
%if %upcase(&reptype) = WEEKLY %then %do;
%else %if %upcase(&reptype) = DAILY %then %do;


**** end of SP program code;

The macro program that is INSIDE my DOREPT.SAS program is defined "in-stream" but, it too could be an AUTOCALL macro. I didn't want to make too many black boxes! I generally keep my macro definitions (%macro/%mend) outside of
%stpbegin/%stpend -- just to keep my housekeeping and debugging easier to keep track of.

Only the call to the %TESTPARM macro needs to be inside %STPBEGIN;/%STPEND; because it is the invocation or %WEEKLY or %DAILY that will really produce my output.

If you are going to do a LOT of conditional processing in your stored process, then you'll end up needing to know about the SAS Macro facility and how to write and use macro programs effectively. The parameters that you set for your stored processes are passed to either the Workspace server or the Stored Process server as Global Macro variables that live in the Global Symbol Table on the server.

Guess who can help you figure out the right location for AUTOCALL macros on your BI installation and/or help you with macro syntax??? Tech Support 😉

Not applicable
Thanks so much for the hints, Cynthia.



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
  • 2 replies
  • 2 in conversation