Do you want to actually remove the seconds or just not display them?
data junk; x='13apr2017:00:00:02'dt; y= round(x,60);/* changes the value*/ put y= datetime20. ; /* or just use a different format to suppress display of the seconds*/ put x= datetime13.; run;
Do you want to actually remove the seconds or just not display them?
data junk; x='13apr2017:00:00:02'dt; y= round(x,60);/* changes the value*/ put y= datetime20. ; /* or just use a different format to suppress display of the seconds*/ put x= datetime13.; run;
@Gil_ wrote:
Hi I need to remove them
The use the Round in the example. Since datetime values are actually numbers of seconds rounding to the nearest multiple of 60 rounds to the nearest minute.
Of if you want to truncate to the minute regardless of the number of seconds you could use INTNX:
data _null_; x='05Apr2017:12:15:22'dt; x = intnx('minute',x,0,'b'); put x datetime20.; run;
data TEST; x='05Apr2017:12:15:22'dt; x = intnx('minute',x,0,'b'); format x datetime20.; put x=; run;
Oracle unfortunately uses different behaviors and I don't work with Oracle so can't help there.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.