BookmarkSubscribeRSS Feed
c4th1
Fluorite | Level 6

Hi, I am trying to do new calculated item in the Report Designer to calculate 'now() - timestamp' to give a total number of days. Can someone please advise how do I do the calculation. And how to show the result in numeric?

 

Thank you.

2 REPLIES 2
MikeJenista
SAS Employee

It is a little cumbersome, but you can use the DayOfYear and Year functions to return numeric values from the two dates ('now' and 'timestamp').  Also you have to wrap 'Now()' in a DatePart() function:

 

 

365*( Year(DatePart( Now() )) - Year( timestamp ) + DayOfYear( DatePart( Now() )) - DayOfYear( timestamp )

MikeJenista
SAS Employee

I checked if a simpler calculation would work:

 

DatePart( Now() ) - timestamp

 

But it did not.  I think this is because the underlying SAS date value is not a supported format for VA content, but I can check on it with some folks I know in development.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 2 replies
  • 886 views
  • 0 likes
  • 2 in conversation