BookmarkSubscribeRSS Feed
0 Likes

Editor's note: this suggestion relates to the SAS code that is generated when you create a date prompt in SAS Enterprise Guide (project prompts or SAS stored processes).

 

I think it's a bug, but SAS may consider it a 'feature'...but when you specify a date as a month, you get this:

 

16         %LET Rcv_Date_min_end = 31Mar2018;
17         %LET Rcv_Date_max_end = 31Mar2018;
18         %LET Rcv_Date_min_label = Previous month;
19         %LET Rcv_Date_max_rel = M-1M;
20         %LET Rcv_Date_min = 01Mar2018;
21         %LET Rcv_Date_max = 01Mar2018;
22         %LET Rcv_Date_max_label = Previous month;
23         %LET Rcv_Date_min_rel = M-1M;

 

So why is the max date the same as the first of the month?  uh...no.  Line 21 should be this:

 

21         %LET Rcv_Date_max = 31Mar2018;

31 Comments
ballardw
Super User

How many reports are run for the previous month?  That's why I changed my program to use date month type. 

But I still think that 'foodate_max' is wrong.

 

What does the number of reports run for the previous month have to do with anything? The question is about generated macro variables and how they are used in this case internally by EG to validate the range of values you are expected to provide or select.

Take a moment and explain why foodate_max is wrong in terms of how the program/project actually behaves.

 

 

 

 

 

 

 

tomrvincent
Rhodochrosite | Level 12

@ballardw because a lot of people run reports for the previous month, that's why.  I also submitted an idea that beg and end of prev month be added to the dropdown menu for default values.

 

The scope is a month and it's called a date range, so max should be the maximum date range.

 

Why is there a Rcv_Date_min_end set to 31Mar2018?  That doesn't make sense either.

 

I was just trying to use one variable instead of 2, since the month date range combo allows you to pick previous month.

Kurt_Bremser
Super User

If you want the reports of a month, then compare the months, not the days.

KatS_SAS
SAS Employee

Hello tomrvincent,

We appreciate your suggestion to enhance the software.   Let me see if I can explain how the macro variables are defined.  The value “MAX” is not referring to the maximum value a user can submit in the date range, but rather the first day “TO” range.  In this case, Min = From value and Max = To value in the date range.  When you specify anything larger than a data type of “DAY”, the system needs to know what the first possible value of the “TO” as well as the last possible value of the “TO” range is labeled with _END on the variable name.  Below is the help on how these macro variables are defined in hopes this helps with the explanation.

 

macros.PNG

Reeza
Super User

@KatS_SAS is this information in the documentation somewhere?

tomrvincent
Rhodochrosite | Level 12

@KatS_SAS  thanks.  I find those labels and definitions somewhat cryptic and misleading...maybe it's just me, but 'max' means the maximum, not the first.  Call it FST, not MIN or MAX if you mean first.  Call it LST, not MAX_END or MIN_END if you mean last.

 

To me, the problem is that changing the date type or date range type means that all the following programs have to be changed, since the names or meanings of the names have changed.

 

So, I'll probably have to give up on ever using month, week, quarter or year date types because I can never guarantee that someone won't want to be able to adjust the range of dates for a report.  That's also why I've requested that beginning and end of the previous month be added to the possible default values for day range.

tomrvincent
Rhodochrosite | Level 12

@Kurt_Bremser I can't guarantee that any given report will only and ever be run for a single month.  Some might need to be run for another date range.

Kurt_Bremser
Super User

@tomrvincent When you need a date range, use date prompts. When you need a month range, use month prompts and compare month(date_variable) with month("&prompt_value"d).

KatS_SAS
SAS Employee

@Reeza The Macro explanation I added is in the Help.  

 

Help->SAS Enterprise Guide Help->Working with Prompts->Understanding macro variables and prompts.

KatS_SAS
SAS Employee

@tomrvincent I understand your point of view with the variable names.  There is a lot of underlying code that would need to be modified since these names have been in place for the last several years.  But I will be glad to pass your suggestion on the naming convention to our development team.