Hi ,
I was wondering if there a way to convert a date from 25/09/2019 to 01/09/2019 in SAS Viya without writing an actual code?
Thanks!
Hi!
If I understand you correct you want to get the first day of the month for a date, if so you can use the following formula:
DateFromMDY(Month('Date'n), 1, Year('Date'n))
Change 'Date'n to your date variable.
You can also click the formula using the formula editor.
You do this by creating a new calculated item 🙂
//Fredrik
This is more than just displaying a value differently. You seem to want to align datetime values to the beginning of the month.
You could either use a format that only returns the month & year (with VA joining/aggregating using the formatted values) or you could create a calculated column and there use a function like intnx().
...and please take whatever I write about Viya with a grain of salt. I'm still getting up-to-speed with it.
Hi!
If I understand you correct you want to get the first day of the month for a date, if so you can use the following formula:
DateFromMDY(Month('Date'n), 1, Year('Date'n))
Change 'Date'n to your date variable.
You can also click the formula using the formula editor.
You do this by creating a new calculated item 🙂
//Fredrik
Wow! It works! thank you so much!
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.