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.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.