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.

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