Date: Wed, 12 Nov 2008 11:13:54 -0600
Reply-To: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "./ ADD NAME=Data _null_," <iebupdte@GMAIL.COM>
Subject: Re: Time interval
In-Reply-To: <001701c944e7$df0b8ca0$1e02a8c0@SIRIUS.ANAXIMA.COM>
Content-Type: text/plain; charset=ISO-8859-1
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
>
|