Desktop productivity for business analysts and programmers

Using functions for default param values in EG4.1

Reply
N/A
Posts: 0

Using functions for default param values in EG4.1

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.
New Contributor
Posts: 3

Re: Using functions for default param values in EG4.1

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
New Contributor
Posts: 3

Re: Using functions for default param values in EG4.1

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
N/A
Posts: 0

Re: Using functions for default param values in EG4.1

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.
Ask a Question
Discussion stats
  • 3 replies
  • 113 views
  • 0 likes
  • 2 in conversation