I tried to calculate Diff by doing computed column > Advanced expression and then `datetime() - t1.datetime / 60 `. Diff is actually the difference between SAS_update and DateTime, SAS_Update is just the lastruntime (datetime())
This is what I got:
I get a very weird value but I expected Diff to have value -1 because there is a a difference of -1 minutes between them SAS_update and DateTime...
Use the function intck.
Datetime-variables are, without a format, the number of seconds passed from 1Jan1960 to the actual datetime. The function takes care of the details, if you need the difference in minutes, then use "dtminute" as interval.
@Andalusia wrote:
Could you show an example?
Looks like this:
intck('minute',t1.datetime,datetime(),"c")
The "c" (for continuous) means that difference / 60 is used, and not the count of minute boundaries between the two values (90 seconds difference can turn out to be 2 minutes if the default is used).
For reference, run this:
data _null_;
time = datetime();
rc = sleep (119,1);
diff1 = intck('minute',time,datetime(),"c");
diff2 = intck('minute',time,datetime());
put _all_;
run;
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!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.