06-12-2013 10:15 AM
I'm just trying to delete some obs - the ones that are created at the same date and hour.
There is a column "creation_time" from which I extrat the creation_hour by using
creation_hour length = 8 format = hour.
creation_hour = timepart(creation_time);
(That doesn't work as I expected it to because '11:47:32' becomes '12' but that is not really important for my task.)
But there is an actual problem: Even if '11:47:32' and '11:48:01' both lead to '12' the two obs still remain, if I try to delete one of them by using
proc sort nodupkey: by creation_hour;
That means the column creation_hour actually still contains the whole information, with minutes and seconds, doesn't it?
How can I change this? I really only want the column to contain the numbers from 1-12 - is that possible? How?
Or is there a better way to do the job?
Thanks for any ideas
06-13-2013 03:02 AM
Thanks for the idea but unfortunately, this doesn't return the hour. Now creation_hour equals zero for all obs - without any errors or anything in the log.
06-13-2013 07:09 AM
Ah, I see.
I used the format 'hour' because with
"creation_hour = timepart(creation_time); "
without this format, the column creation_hour contained numbers from zero to 86.399 (counting the seconds).
But with the correction
"creation_hour = hour(creation_time); "
the format is indeed not necessary.
Thanks a lot to both of you!