Dear Experts,
I have two variables ID and Date. I need to get a max date value, tried everything but not able to find a way so please help me.
ID | dates |
B0001 | 01/17/2018 |
B0002 | 11/20/2017 |
B0003 | 01/16/2018 |
B0004 | 11/19/2017 |
B0005 | 01/15/2018 |
B0006 | 11/18/2017 |
B0007 | 01/14/2018 |
B0008 | 11/17/2017 |
B0009 | 01/13/2018 |
B0010 | 11/16/2017 |
What do you want to do more specific?
The easiest way is to add a list table and then sort in descending date order and look at the first row 😉
//Fredrik
Hi Fredrike,
My requirement is to calculate and create a data item which should contain the latest data i.e. 17 Jan 2018 in the given sample data.
That data item will be used in a button bar to highlight Data Refreshed On.
I hope, I am making sense here.
Thanks
Hello Rahul,
Here is a previous discussion about max date in VA:
If you just want to display the max date in your report, you can use a rank to select the "top 1" date.
If you need to perform any calculations using the max date, you will need to create a column in your data query using the MAX() function.
Also in 8.2 or 7.4, you can display the timestamp of the most recent update to the data source in a Text object. (Search the doc for "Dynamic Text") But this is not necessarily the same thing as the max date in your data and I believe you cannot do any calculations with this value.
Let us know if this helps.
Thanks,
Sam
Oki!
Create a new calculated item, use your date variabel and "treatAs" number. Set aggregation to max.
Add a button bar and set your date variabel as category, then rank and pick the highest 1 from your calculated variable.
This will make your button bar show only the highest date in your data.
//Fredrik
hi Fredrik,
please guide me how to set a date variable to category variable.
thnx
Hi Rahul,
You can assign your date variable to the Category role of the button bar. It is not necessary to convert it to a category data type.
Sam
As @Sam_SAS says assign it as category role of the button bar, I translated my swedish to english, my bad 🙂
//Fredrik
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.