Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Advanced Date Filter

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 15
Accepted Solution

Advanced Date Filter

[ Edited ]

I'm trying to build a filter within a crosstab to automatically filter the date. 

 

I have 14 months of data, Dec 16' - Jan 18', but I only want to show data from 4 months ago (This month that would be Oct. 17').  My data set updates each month by rolling forward one month (e.g. my next data set will have dates raning from 1/1/17 - 2/28/18) and I will need the filter to grab data from Nov. 17' only.

 

I currently have this as the syntax of the filter but it is not working correctly.

DatePart(AppVintage) = DateFromMDY(( Month(DatePart(Now())) - 4 ), 1, Year(DatePart(Now())))

 The format of the date field (AppVintage) is DATETIME22.3

 

Can someone help me with this issue?

 

Thanks!

Adam


Accepted Solutions
Solution
‎02-09-2018 03:59 PM
PROC Star
Posts: 401

Re: Advanced Date Filter

Posted in reply to awmeyertimmy
Create a numeric meassure from year and month and then use rank to select then highest 4. Smiley Happy //Fredrik

View solution in original post


All Replies
Super User
Posts: 13,941

Re: Dynamic Date Filter

Posted in reply to awmeyertimmy

I don't use VA so I'm not sure of all the functions that may be available. If you have the INTNX function that will increment date, time and datetime values.

 

so perhaps

AppVintage = intnx('dtmonth',now(),-4,'B');

 

which if the function intnx is available should return the time of the beginning day of the month 4 previous.

Occasional Contributor
Posts: 15

Re: Dynamic Date Filter

INTNX would work great! However, I don't believe it's available in Visual Analytics.  That's why I'm stuck. Thanks though!

Super User
Posts: 13,941

Re: Dynamic Date Filter

Posted in reply to awmeyertimmy

If a base SAS function such as INTNX or INTCK would be helpful and isn't available in VA you might consider posting a request to add them in the SASWare Ballot section of the forum: https://communities.sas.com/t5/SASware-Ballot-Ideas/idb-p/sas_ideas

Solution
‎02-09-2018 03:59 PM
PROC Star
Posts: 401

Re: Advanced Date Filter

Posted in reply to awmeyertimmy
Create a numeric meassure from year and month and then use rank to select then highest 4. Smiley Happy //Fredrik
Occasional Contributor
Posts: 15

Re: Advanced Date Filter

Brilliant! Thanks
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 308 views
  • 1 like
  • 3 in conversation