BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
P3
Fluorite | Level 6 P3
Fluorite | Level 6

When using the function now() in SAS VIYA 4 (building a report and making a calculated item to determine something is in the past or the future) I see rows up to 1 hour in the past that still get seen as in the future. So now() is reporting a time that is 1 hour before the real current datetime.

 

Of course I immediately thought it had to do with DST or something like that.

 

When using Studio the datetime() function returns the correct system-datetime.

Jobs that produce the data and writes the CAS-tables also use the correct datetime.

 

All the servers used, are set to the right time (according to administrators).

 

I tried setting DST_Enabled to True in the Environment Manager, but that didn't do the trick. At least, an administrator did that for me, as I am not allowed to go there.

 

Any ideas on how I could get the now()-function to return the correct time?

1 ACCEPTED SOLUTION

Accepted Solutions
HunterT_SAS
SAS Employee

Oh yes Viya 3.5 is going to be a little different here. Are you (or the server technically) in the CEST timezone by any chance? If so there was a bug in Viya 3.5 where it is an hour off and you can workaround it following these steps:

 

Modify casconfig_usermods.lua on controller node,
•Edit this file: /opt/sas/viya/config/etc/cas/default/casconfig_usermods.lua
•Set this property: cas.TIMEZONE='Europe/Amsterdam'
•Restart CAS controller

 

Otherwise it should be pulling the time from the Viya 3.5 server itself (wherever CAS is running).

View solution in original post

8 REPLIES 8
Kurt_Bremser
Super User

I see no entry for a NOW function in the SAS documentation.

So this is either an undocumented function (which should not be trusted), or something created with PROC FCMP at your site (go looking for the source code).

Quentin
Super User

It looks like NOW() is a Visual Analytics function, not a SAS language function.  I'm going to try moving this question the visual analytics community.

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
PaigeMiller
Diamond | Level 26

In my SAS Viya 4, I get errors when I run the NOW() function.

 

PaigeMiller_0-1745846356653.png

 

 

Perhaps you want the TIME() function, or as @Kurt_Bremser someone has created that for all users using PROC FCMP. In that case, if the time is one hour off, that should be easy for you to adjust.

--
Paige Miller
Quentin
Super User

Apologies @Kurt_Bremser .  When I moved this to visual analytics, I accidentally moved your reply first, so you're now the owner of the thread, instead of @P3 who asked the question.  I don't see a way to make the original question the question again.  

The Boston Area SAS Users Group is hosting free webinars!
Next up: SAS Trivia Quiz hosted by SAS on Wednesday May 21.
Register now at https://www.basug.org/events.
HunterT_SAS
SAS Employee

The Now() function in VA can be controlled by a JVM property timezone setting for the reportExecution service/pod described here:

https://go.documentation.sas.com/doc/en/vacdc/v_029/varef/p1t3sqzzeb69h1n1t52gw8nr73eb.htm

 

If this property is not defined for the service, then it defaults to the timezone of the report execution pod, which you could check with this kubectl command:

 kubectl -n <namespace> exec <report execution pod name> -- date

where namespace and report execution pod name are the right values for your environment. I suspect though you just need to set the JVM property from the link above to your timezone and that should do the trick. 

P3
Fluorite | Level 6 P3
Fluorite | Level 6

Couldn't find the reportExecution configuration. But I just heard that we are running on VIYA 3.5. So maybe it is a newer option.

 

HunterT_SAS
SAS Employee

Oh yes Viya 3.5 is going to be a little different here. Are you (or the server technically) in the CEST timezone by any chance? If so there was a bug in Viya 3.5 where it is an hour off and you can workaround it following these steps:

 

Modify casconfig_usermods.lua on controller node,
•Edit this file: /opt/sas/viya/config/etc/cas/default/casconfig_usermods.lua
•Set this property: cas.TIMEZONE='Europe/Amsterdam'
•Restart CAS controller

 

Otherwise it should be pulling the time from the Viya 3.5 server itself (wherever CAS is running).

P3
Fluorite | Level 6 P3
Fluorite | Level 6

That did the trick. Thanks so much!

sas-innovate-white.png

Missed SAS Innovate in Orlando?

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.

 

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
  • 8 replies
  • 1035 views
  • 0 likes
  • 5 in conversation