Hi, I've got a date field in my table and I need to get the most recent date in it.
I'm working in SAS VA 7.1 and tried creating an item field using the MAX function but gives me error.
any idea how can I get the max date ?
If you just want to display the most recent date in a table, the simplest solution is to sort a table in descending order by your date column.
I don't think there is an easy way in the VA expression syntax to calculate the most recent date.
You can use the TreatAs operator in a calculated measure to convert the date into a numeric, and then create an aggregated measure using the Max() operator on that calculated item. This will give you the most recent date, but the date is no longer in date form. It will look like this: 19833.
If you want to show Max date in VA, you have to create Max date column in SAS table using MAX function.
As per sam you can Calculate Max date using calculated items(Treat As) and Aggregated Measures(_Max_). but the result will be in sas days.
If you want top see the date in a table
In the example above I have a second column showing when the data was refereshed by sas, to do this I just added column in my underlying data query which inserts todays date against every row.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.