BookmarkSubscribeRSS Feed
saslover15
Obsidian | Level 7

So we figured out how to automate our project with help from these boards, as we are able to set the values of most ProjectParameter objects, per this post:

https://communities.sas.com/t5/SAS-Enterprise-Guide/Is-it-possible-to-run-a-SAS-EG-project-THAT-NEED...

 

So we are able to set the value when a field is just a free-form text field,  a password field, or a drop-down list.  But we are stuck on fields where a user picks a date range from the prompt window using the little calendar icons.  For now, we have the date ranges defaulted in the egp files, so that the automation will run successfully, but obviously we want the user to pick what dates they want, rather than using the defaults.

 

 

For a date range field, there is only one parameter, but two values. The date range prompt, for example, has a name of PAID_DATE....when we run in thein the project it comes through as PAID_DATE_min and PAID_DATE_max, but we cannot fine where these parameter values are set anywhere in the ProjectParameter objects. 

 

Does anyone have any clues how to set parameters for date ranges in an automation?

 

4 REPLIES 4
saslover15
Obsidian | Level 7

Here is an update and clarification of the problem we are having..  This "Case" statement below needs a "Select Case", such as:

 

      Select Case SomeVariableName

Case "PD_DT_min" ' ProjectParmTypeDate(0)

prm.Value = ‘“01Jan2019”’

Case "PD_DT_max" ' ProjectParmTypeDate(0)

prm.Value = ‘“12Dec2019”

      End Select

 

 

 

It doesn't matter WHAT we fill in for "SomeVariableName" - we have tried just PD_DT, among other things - nothing works, all fail.  Can a date range simply NOT be done in an egp file intended for automation?  What should we be filling in for "SomeVariableName" to be able to pass a date range in?

Tom
Super User Tom
Super User

Make sure the real code does not have the "smart" quotes you posted.

 

Don't parameters become macro variables?  Why aren't you referencing the macro variables?

 

Is that SAS code?  What is the (0) after ProjectParmTypeDate?

saslover15
Obsidian | Level 7
Hi Tom! Thanks! We will make sure about the quotes. Yes, parameters do become macro variables. This is VB.net code I posted. But HOW do we access the macro variables in the first place to be able to set their values before the SAS code run? That is where we are stuck. HOW to access the macro variables.
Tom
Super User Tom
Super User

@saslover15 wrote:
Hi Tom! Thanks! We will make sure about the quotes. Yes, parameters do become macro variables. This is VB.net code I posted. But HOW do we access the macro variables in the first place to be able to set their values before the SAS code run? That is where we are stuck. HOW to access the macro variables.

In EG the user is prompted to make a selection. If you read the thread you linked the best suggestion is to just write your code to use the same macro variable names as the EG prompt was generating.  And then just call the code via some easy to replicate process.  Like the Unix command line.

 

Say it was generating these two macro variables.  

%let date_min=01AUG2019;
%let date_max=01JAN2020;

Then the code is normally written to just use the macro variables:

where somedate between "&date_min"d and "&date_max"d 

Now if you wanted to make the same code work if instead the values are present in environment variables named date_min and date_max instead you could add at the top of the program:

%if 0=%length(&date_min) and 0<%sysfunc(envlen(date_min)) %then %do;
  %let date_min=%sysget(date_min);
%end;
%if 0=%length(&date_max) and 0<%sysfunc(envlen(date_max)) %then %do;
  %let date_max=%sysget(date_max);
%end;

Then if you are running the code via EG and the user has answered the prompts the macro variables are set.  But if you want to run it outside of EG you can just use the -set command line option to set the dates into the corresponding environment variables instead.

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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