LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 9 Mar 2004 18:31:31 +0200
Reply-To:     Arto Raiskio <arto-nospam@RAISKIO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Arto Raiskio <arto-nospam@RAISKIO.COM>
Subject:      Re: how to use sql coalesce with time

Sigurd, thank you very much for the effort

I'm afraid somehow you must've missed my sample case-2 which gave the desired output format for example, the _code_ value *must* be a combination of the ycode(codes) into one string notice how the Record1(123456780) becomes 2 output lines since there is over 60 minutes of time elapsed from code MA to code MB (there can be many more codes, not limited to just 2) notice how Record1(123456790) becomes 1 output line since the time lapsed is just 11 minutes)

data b has the problem example and required output

ie. data b;input record1 $10. ycode $ tstamp time.; datalines; 123456780 MA 08:15:00 /* 5 min after data a */ 123456780 MB 09:29:00 /* over 1 hour after data a */ 123456790 MA 08:20:01 /* 10 min after data a */ 123456790 MB 08:22:01 /* 11 min after data a */ run;

assume also the timestamp in data B would be a few minutes after the timestamp in data A, ie. 08:10:00 vs. 08:15:00 (within 15 minutes)

what would be a simple way to produce the following output

Record1 TimeStamp _code_ 123456780 8:15:00 MA 123456780 9:29:00 MB 123456790 8:20:01 MA MB


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