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!
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.