BookmarkSubscribeRSS Feed
0 Likes

to this dropdown menu, add those 2.  This would help with reports that are run for the previous month.

 

image.png

14 Comments
ballardw
Super User

And if you change the date type to Month instead of DAY what do you see in the available default value list?

 

fifthand57th
SAS Employee

@tomrvincent 

 

I believe @ballardw 's suggestion is what you are looking for. Is this correct?

fifthand57th
SAS Employee
Status changed to: Suggestion Implemented
 
tomrvincent
Rhodochrosite | Level 12

@fifthand57th not exactly.  It's helpful, but doesn't give the flexibility of 2 date variables (to allow for a variety of date ranges)

ballardw
Super User

@tomrvincent

 

I think that you need to very clearly state what you are using this prompt for.

The response

  It's helpful, but doesn't give the flexibility of 2 date variables (to allow for a variety of date ranges)

Is not exactly clear what you mean. There is a minimum and maximum field to set. That is two values.

 

Not to mention if the whole project only ever runs on the month's data previous to the when the project is executed then an offset using the INTNX function with Today() may well be all that is needed. But without a clue as to what the prompt is actually being used for there are lots of comments that would not be relevant. And the discussion in the SASWare ballot area isn't the place to start these discussions until it has been confirmed that what you want is either not possible or should be something common to many users. Just saying "running a report for the previous" month is insufficient description of what is going on.

So what is the purpose of the prompt?

How are you using the result?

What "flexibility of 2 date variables" do you actually need?

 

I am sure other questions will arise with answers to those but may get started in the right direction.

 

 

tomrvincent
Rhodochrosite | Level 12

@ballardw  In running a report, often people want to specify a start and end date. 

 

Maybe you haven't seen that or can't clearly imagine that scenario.

 

In any case, if the report is normally supposed to select records for the previous month, it would be nice if the start date was the beginning of the previous month and the end date was the last day of the previous month.

 

However, they may want to change either or both of those dates and so they need to be separate.

 

Get it?  Maybe running reports isn't something you do or can picture others doing.  If that's the case, perhaps you should opt out of the discussion of something that isn't relevant to you.

Reeza
Super User

@tomrvincent you're being rude. 

ChrisHemedinger
Community Manager

@tomrvincent I'm not sure that there will be new date-oriented additions added the the myriad of prompt options, but you can do a lot with code that processes the prompts that exist -- converting the values to what you need.  If you want to dive deep, learn about the %eg_WhereParam macro -- some info in this blog post.

tomrvincent
Rhodochrosite | Level 12

@Reeza not at all.  I was asked to clarify and I did. He/she clearly doesn't understand the dynamics of running reports with date ranges.

ballardw
Super User

 I was asked to clarify and I did. He/she clearly doesn't understand the dynamics of running reports with date ranges.

 

I beg to differ. I have been writing report that work on annual (fiscal, calendar, water year) , quarterly, monthly, weekly and daily intervals off and on for over 25 years.

 

What I think you are not getting is that without a very clear definition, which you have not stated, of what sort of limits you need and how you intend to use them you are sort of wandering around the topic.

 

If the requirement is to specify an interval such that the data is selected between dateX and dateY there are likely a number of issues involved, again not specified. One way involving prompts might be two different prompts, another is if the end or start is dependent upon a single given value such a provide and end date and then calculate the other value such as such as 5 days prior, 2 weeks prior starting on the Monday of that first week, or such. Then set that value as the beginning interval.

 

But you have not provided any such description. Just "previous month". Are you selecting data? Validating that a value a user is entering is from the previous month? Are you using this prompt only to create title text? Prompts can be used for large number of things.

 

There is also even a question of do you need a prompt at all? You say previous month.

If I have data that I need to extract with date values from the previous calendar month and I know that each and every time I run the program that is the requirement in the date the program executes then code such as

data want;
   set have;
   where intnx ('month',today(),-1,'B') le datadatevar le   ('month',today(),-1,'E');
run;

will select the records where the datadatevar (given that the variable contains valid SAS date values) is in the previous calendar month. No prompt needed. It will use the same range of dates to select records from the data set have when ever I run the program in a given month. If I run it on 6Apr2018 it will use 1Mar2018 and 31Mar2018 as limits. If the program is run on 30Apri2018 it will use the same limits to select the data. When May 2018 rolls around then when the program runs it will select records from that data set with dates between 1Apr2018 and 30Apr2018 (assuming the set has been updated in the meantime to have such records).