Hello everyone,
Is it also possible in SAS VIYA to display the last date of the month? I currently have a table with various dates and values. However, I only want to see the last day of the respective month. Is this possible in SAS VIYA?
In any case, thank you for the responses.
Regards, Hans
You can calculate the last day of the month based on some date using this expression. Where myDate is the Datum dataitem in your example. Depending on your version of Visual Analytics you can subtract a number directly from a date, otherwise you need to use the TreatAs function.
DateFromMDY( Mod(Month(myDate), 12) + 1 , 1 , Year(myDate) + Trunc(Month(myDate) / 12) ) - 1
Once you have the new data item, you can use it in a filter to specify some like
datum = last_day_of_month
We would need more information like:
thank you for your response.
I'm using Visual Analytics (VIYA). It concerns the last day of the month.
I only want to see the dates highlighted in yellow (see image).
You can calculate the last day of the month based on some date using this expression. Where myDate is the Datum dataitem in your example. Depending on your version of Visual Analytics you can subtract a number directly from a date, otherwise you need to use the TreatAs function.
DateFromMDY( Mod(Month(myDate), 12) + 1 , 1 , Year(myDate) + Trunc(Month(myDate) / 12) ) - 1
Once you have the new data item, you can use it in a filter to specify some like
datum = last_day_of_month
Thank you very much. It worked!
@HansSteenhuis wrote:
thank you for your response.
I'm using Visual Analytics (VIYA). It concerns the last day of the month.
I only want to see the dates highlighted in yellow (see image).
One simple way to test if a value is the last day of the month is to check if the next day is a different month.
In normal SAS code such a test could be :
month(datum) ne month(datum+1)
Which will be TRUE when DATUM is the last day of a month.
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.