```Date: Sat, 15 Sep 2007 20:45:25 -0400 Reply-To: "Howard Schreier " Sender: "SAS(r) Discussion" From: "Howard Schreier " Subject: Re: days with gt 24 hours - merging by time On Tue, 11 Sep 2007 02:54:40 GMT, Theorbo wrote: >Hi. I'm looking for some other ways of thinking about my seemingly-simple >problem. I have 2 datasets of radio ad-sales data and I want to merge them >together, primarily by TIME. The data's definition of 'day' is approximately >6am on one day through 6am on the following day. I would like to keep the >definition that time after midnight until 6 am is still the previous day. "Approximately" is troublesome. I will presume that the day is exactly 6 am through 5:59:59 am. See http://sascommunity.org/wiki/Non-standard_Days >__Dataset 1__ >obs, date, time, program, advertiser >1, 09/01/07, 1:00 AM, The News, Advertiser A >2, 09/01/07, 1:01 AM, The News, Advertiser B >3, 09/01/07, 1:02 AM, The News, Advertiser C >4, 09/01/07, 1:02 AM, The News, Advertiser A >5, 09/01/07, 1:03 AM, The News, Advertiser D > >__Dataset 2__ >obs, date, time, program, advertiser >1, 09/01/07, 25:00:30, The News, Advertiser A >2, 09/01/07, 25:01:00, The News, Advertiser B >3, 09/01/07, 25:02:00, The News, Advertiser C >4, 09/01/07, 25:02:30, The News, Advertiser A >5, 09/01/07, 25:03:00, The News, Advertiser D > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >In both of these datasets, the ACTUAL DAY (by the calendar) is 9/2, but I >need to consider it 9/1 for my purposes. Ideally, it seems that the best >way would be to keep the dates as indicated in the datasets but to have time >(hour values) go to 29-30 each 'day'. > >I've tried a few things and everything so far seems like a hack-job or >worse. I've tried: > > 1) scrapping SAS date & time values altogether and just using hour & day >variables (1-xy) - not good for the long run because you always need a >codebook to know what an hour and day variable value correspond with. I want >to use SAS time/date values if at all >possible. > > 2) using informats - but I couldn't find an informat that easily dealt >with the time in Dataset 1 (AM/PM) or Dataset 2 with hours gt 23 > > 3) reading the dates and times as \$ and then substring-ing out what I >need to piece it all back together. Doesn't seem like the HMS() will handle >hours gt 23 > >Saying all of this, I imagine that I'm fixating on one solution for skinning >this cat. What are some other, perhaps-obvious, ways to look at this >problem? > >Many thanks, >theorbo ```

Back to: Top of message | Previous page | Main SAS-L page