BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Lena2017
Calcite | Level 5

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!

1 ACCEPTED SOLUTION

Accepted Solutions
FredrikE
Rhodochrosite | Level 12

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

View solution in original post

3 REPLIES 3
Patrick
Opal | Level 21

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.

FredrikE
Rhodochrosite | Level 12

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

Lena2017
Calcite | Level 5

Wow! It works! thank you so much!

SAS INNOVATE 2024

Innovate_SAS_Blue.png

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. 

Register now!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 3 replies
  • 638 views
  • 2 likes
  • 3 in conversation