BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I want to use a function to define a default value for a parameter.

This is how my param is defined:

Type of Param: Date
Name: StartDate
Enclose user input with: Double quotes
Default Value: intnx('month',today(),-1,'end')

But the default Value I am putting in is not working.? I have also tried putting %sysfunc around it - but to no avail.

Is is possible to use functions when specifying default values in Enterprise Guide 4.1?

Many Thanks.
3 REPLIES 3
Colin
Calcite | Level 5
I would prompt for a date, DefaultDate, default today, then use it to build StartDate in the code:

%let StartDate="%sysfunc(
putn(%sysfunc( intnx(month,&PromptDate,-1,end) ),date9.)
)"d;
%put StartDate=&StartDate;

Colin
Colin
Calcite | Level 5
Correction

I would prompt for a date, PromptDate, default today, then use it to build StartDate in the code:

%let StartDate="%sysfunc(
putn(%sysfunc( intnx(month,&PromptDate,-1,end) ),date9.)
)"d;
%put StartDate=&StartDate;

Colin
deleted_user
Not applicable
Thanks Colin.

This works.

However, what I really want to do - is have an 'intelligent' default value displayed to the user and also give the user the ability to override if they need to.

Therefore, I really want to be able to apply the date function to the default value of the parameter. Ie. I want to put the date function as per below in Default value box in the Parameters Manager screen.... But I just can't get this to work... Perhaps its not possible?

I have played with is a bit and it seems to me that SAS will ALWAYS run the built-in Enterprise Guide macro code (for the parameter) first... and then run code that I write in a module after that. I guess if there was a way to get it to run my code first it might be a way around this..? (ie. write code to work out the default value of the Enterprise Guide parameter and get this code to somehow run first)

Hope this makes sense.

Thanks
Georgina.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 895 views
  • 0 likes
  • 2 in conversation