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

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 807 views
  • 2 likes
  • 3 in conversation