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
SAS Super FREQ
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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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