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.
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!
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.