Date: Wed, 12 Nov 2008 11:27:35 -0600
Reply-To: Sid N <nsid31@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Sid N <nsid31@GMAIL.COM>
Subject: Re: Time interval
In-Reply-To: <ce1fb7450811120913g44c0022fvf8206d13463c2cf0@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1
Thank you for your replies. The 24-h times are in character format.
I was able to determine the interval using the following code:
T1 = input(substr(Time1,1,2)||":"||substr(Time1,3,2)||":",hhmmss.);
T2 = input(substr(Time2,1,2)||":"||substr(Time2,3,2)||":",hhmmss.);
Difference = intck('minutes', T1, T2);
On Wed, Nov 12, 2008 at 11:13 AM, ./ ADD NAME=Data _null_, <
iebupdte@gmail.com> wrote:
> On 11/12/08, Allen Ziegenfus <aziegenfus@anaxima.com> wrote:
> > Couldn't you just subtract the two and divide by 60 or am I missing the
> > point here?
>
> Yes because the units are not seconds for example 1337 is not in
> seconds units it is 49020 seconds.
>
> 210 data _null_;
> 211 a=1224;
> 212 b=1337;
> 213 c = b - a;
> 214 aT = input(put(a/1e2,5.2),time.);
> 215 bT = input(put(b/1e2,5.2),time.);
> 216 dT = bT - aT;
> 217 dM = dT / 60;
> 218 put 'NOTE: Results' @;
> 219 put (_all_)(/= 'NOTE- ');
> 220
> 221 *format aT bT time. dt mmss.;
> 222 run;
>
> NOTE: Results
> a=1224
> b=1337
> c=113 *** this is not 73 as it should be;
> aT=44640
> bT=49020
> dT=4380
> dM=73
>
>
> >
> > -----Ursprüngliche Nachricht-----
> > Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] Im Auftrag von
> Sid N
> > Gesendet: Mittwoch, 12. November 2008 17:37
> > An: SAS-L@LISTSERV.UGA.EDU
> > Betreff: Time interval
> >
> > I am trying to find the difference (in minutes) between two times which
> are
> > in the format hhmm (24-hr format). For example, the difference between
> 1224
> > and 1337 should result in 73 minutes.
> >
> > Is there a function in SAS that can be used directly?
> >
> > Thank you for your attention.
> >
> > Sid
> >
>
|