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?
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).
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).
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.
In my SAS Viya 4, I get errors when I run the NOW() function.
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.
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 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.
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.
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).
That did the trick. Thanks so much!
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.
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.