BookmarkSubscribeRSS Feed
Calcite | Level 5
I have many input stored process parameters already defined in a stored process in multiple groups. I don't have all of them required to input by the user. But atleast one parameter is required to run the stored process smoothly.

So can we check atleast one parameter value is entered before submitting the Stored process to run? Is there any validation allowed in defining them before going to the server?

If the stored process is invoked only in web, we can add some java script functionality and can do validation part. But my stored proc mostly invoked by MS office applications.

Thanks in advance!
If you marked at least one of the input parameters as REQUIRED, then at least THAT parameter would have to be provided in order for the stored process to run. If you have default values for the other parameters, then the default value would be used if they did NOT pick any choice for the other parameters.

Of course, once your stored process starts to execute on either the Stored Process server or the Workspace server, you could have SAS Macro programming logic (in a macro program) change the values of the parameters if the combination of unset parameter default values do not make sense. Something like:
%global type place mytitle;
/* define the CKPARM macro program "instream" */

%macro ckparm;
/* These 2 parm values are incompatible */
%if (&type = ALL and
&place= Europe) %then %do;
%let type = Europe;
%let mytitle = Report for &place;
%else %if &type = ALL and
&place= %then %do; /* no selection for PLACE */
%let place= ALL; /* set value for PLACE to ALL */
%let mytitle = Report for All Countries;
%mend ckparm;

/* Now invoke the ckparm macro program */

/* Finally, invoke the STPBEGIN/STPEND macros with other code */
/* That uses the &type, &place and &mytitle macro vars */
*** other code to produce results that uses the macro variables;


However, if what you want to do is do some client-side validation BEFORE the stored process code is submitted, you would have to do that by coding your own front end (in whatever form -- HTML, Java, etc) and then invoking the stored process using the Stored Process Web Application. The Stored Process Web Application allows you to invoke a SAS Stored Process via URL.

It may be easier to make a parameter that is required such as: [pre]
Parm Desc Macro Var Name Possible Values
How To Run howrun Take All Defaults
Use My Selections

And then make sure that you specify defaults for all the other parameters. Then you can do any checking in your macro progerm instead of using the Stored Process Web Application and your own front end. If you need more help with using the SAS Macro Facility or SAS macro conditional logic, contact Tech Support.

If you want to learn more about the SPWA, you will find documentation here:




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