BookmarkSubscribeRSS Feed
SanjayM
Calcite | Level 5
Oops!! Sounds funny......

Gurus,

I want to create a report. Report is created in EG and then a Stored Process is created out of it. The report should be with parameters (with prompt) so that the testing team can test the monthly/daily reports by entering the month and date parameters. The parameters may be "Month and Year" for Monthly reports and "Date" for Daily reports.

But acctually these reports are going to be scheduled later. i.e the Stored Process (.sas file) will be executed.

Can I create parameters with default values as Last month or Last Day so that when these reports are run through a schedule the parameters are NOT prompted and the default values are used.
1 REPLY 1
Cynthia_sas
Diamond | Level 26
Hi:
When you register your stored process in the Metadata, using the Stored Process Wizard in EG (or using SAS Management Console) you CAN define a default parameter value, which will be used if there is nothing specified when the stored process is invoked (as when you write a custom app or invoke using the stored process web app.)

As described on this page:
http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/input.html

Defining Parameters
Most stored process client interfaces allow a client to pass any input parameter. There is no requirement to define parameters before executing the stored process, but there are many advantages to describing parameters in stored process metadata:

--Parameter definitions can specify labels and descriptive text. This information can be used by client interfaces to present a more attractive and informative user interface. Other presentation options include grouping parameters and expert flags.

--Default values can be specified. The default value is used if the parameter value is not specified by the client.

--Default values can optionally be flagged as non-modifiable to allow a fixed parameter value to always be passed into a stored process. This can be useful when using an existing program that accepts many input parameters. You can register a new, simpler stored process that has some fixed value parameters and fewer client specified parameters.

You can also register multiple stored processes for a single program. Each stored process definition can pass in unique fixed parameter values to the executing program to force a particular operation or otherwise affect the execution of the stored process.


You could also control the value for input parameters using macro program logic, such as this:
[pre]
%if &reptype = %then %let reptype = Date;

%if %upcase(&reptype) = DTAE %then %let reptype = Date ;
[/pre]

which is testing for a null value for &REPTYPE and setting the value for Date in the first %IF statement and doing a minor adjustment in the second %IF statement (in case you let them type the parameter value instead of choosing it from a drop down list).

But, macro conditional logic must be contained within a macro program, it is not allowed in "open" code. For more help with macro programs, you should consult the SAS Macro Facility documentation or contact Tech Support.

cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1 reply
  • 954 views
  • 0 likes
  • 2 in conversation