Exploring, predicting and reporting with SAS Visual Analytics and SAS Visual Statistics

Date format on screen (DD-MM-YYYY)

Accepted Solution Solved
Reply
Contributor
Posts: 23
Accepted Solution

Date format on screen (DD-MM-YYYY)

In SAS VA I was trying to create a certain date format, but I can't get it to work.

 

By creating a calculated field, I can change the date format into DDMMJJJJ, but it shows DD/MM/YYYY and not the Dutch format DD-MM-YYYY.

 

Is there anyone that can tell me if this can be fixed and if so, how it can be done?

 

Thanks in advance.


Accepted Solutions
Solution
‎04-19-2016 07:55 AM
Contributor
Posts: 23

Re: Date format on screen (DD-MM-YYYY)

It might be a bit unorthodox, but this worked for me:

 

Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Format('DATEn[Raw], 'DTDATE9.'), 'JAN', '-01-', _First_), 'FEB', '-02-', _First_), 'MAR', '-03-', _First_), 'APR', '-04-', _First_), 'MAY', '-05-', _First_), 'JUN', '-06-', _First_), 'JUL', '-07-', _First_), 'AUG', '-08-', _First_), 'SEP', '-09-', _First_), 'OCT', '-10-', _First_), 'NOV', '-11-', _First_), 'DEC', '-12-', _First_)

 

View solution in original post


All Replies
Occasional Contributor
Posts: 16

Re: Date format on screen (DD-MM-YYYY)

Hi xangadix,

 

It would be helpful to see the formula you use in the calculated item.

 

Some thoughts:

  • If it's a real date value, maybe the local settings can solve your problem. If you have the language in VA set to English, you also get the English formatting for dates and currencies etc. If you set it to Dutch does it change to the required format?
  • If you're using the Format function to create a character string, you can use the replace function to replace the / with a -

If this doesn't solve it, can you please post more info?

 

Thanks!

Lodewijk

Contributor
Posts: 23

Re: Date format on screen (DD-MM-YYYY)

Thanks Lodewijk, I'll give that REPLACE idea a try tomorrow.

 

If that doesn't work out, I'll post more info.

Occasional Contributor
Posts: 16

Re: Date format on screen (DD-MM-YYYY)

Also be sure to check out this article about using dates in parameters: Date parameters in SAS Visual Analytics

Since there's no option to have a true date in a parameter, you have to use tricks to use numeric and/or character parameters. The article is about these tricks, where the Format, Replace and Parse functions in conjunction with date formats solve the issue.

 

Best regards,

Lodewijk

 

 

 

 

Solution
‎04-19-2016 07:55 AM
Contributor
Posts: 23

Re: Date format on screen (DD-MM-YYYY)

It might be a bit unorthodox, but this worked for me:

 

Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Format('DATEn[Raw], 'DTDATE9.'), 'JAN', '-01-', _First_), 'FEB', '-02-', _First_), 'MAR', '-03-', _First_), 'APR', '-04-', _First_), 'MAY', '-05-', _First_), 'JUN', '-06-', _First_), 'JUL', '-07-', _First_), 'AUG', '-08-', _First_), 'SEP', '-09-', _First_), 'OCT', '-10-', _First_), 'NOV', '-11-', _First_), 'DEC', '-12-', _First_)

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 600 views
  • 2 likes
  • 2 in conversation