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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.