From: Arthur Tabachneck on
Dan,

I'll be the first to admit that I NEVER work with time data, but the
following are the results I got when I ran the code:

options datestyle=dmy;
data have;
informat dt1 dt2 anydtdtm17.;
input dt1 dt2;
format t1 t2 time8.;
t1=timepart(dt1);
t2=timepart(dt2);
minutes=timepart(dt2)-timepart(dt1);
cards;
25/01/10:07:10:25 25/01/10:07:11:25
;

proc print data=have;
run;

Obs dt1 dt2 t1
t2 minutes

1 1580022625 1580022685 7:10:25 7:11:25 60

Art
-------
On Thu, 25 Feb 2010 08:41:45 -0800, Nordlund, Dan (DSHS/RDA)
<NordlDJ(a)DSHS.WA.GOV> wrote:

>Art,
>
>But that result was 60 seconds, not minutes, unless I am reading the time
wrong.
>
>Dan
>
>Daniel J. Nordlund
>Washington State Department of Social and Health Services
>Planning, Performance, and Accountability
>Research and Data Analysis Division
>Olympia, WA 98504-5204
>
>
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of
>> Arthur Tabachneck
>> Sent: Thursday, February 25, 2010 6:52 AM
>> To: SAS-L(a)LISTSERV.UGA.EDU
>> Subject: Re: Converting a timestamp to a SAS time
>>
>> Mark,
>>
>> Take a look at the example from my post earlier today. The result was
60
>> and no division was needed.
>>
>> options datestyle=dmy;
>> data have;
>> informat dt1 dt2 anydtdtm17.;
>> input dt1 dt2;
>> minutes=timepart(dt2)-timepart(dt1);
>> cards;
>> 25/01/10:07:10:25 25/01/10:07:11:25
>> ;
>>
>> Art
>> ------
>> On Thu, 25 Feb 2010 08:48:07 -0500, Mark Miller <mdhmiller(a)GMAIL.COM>
>> wrote:
>>
>> >Just like for a pair of SAS <date> vars or SAS <time> vars,
>> >the difference between a pair of SAS <datetime> vars
>> >can be computed directly by subtraction
>> > i.e. <datetime1 - datetime2>
>> >The difference is in seconds.
>> >Divide by 60 to get minutes.
>> >
>> >... Mark Miller
>> >
>> >On Thu, Feb 25, 2010 at 7:43 AM, Arthur Tabachneck
>> <art297(a)netscape.net>wrote:
>> >
>> >> Nick,
>> >>
>> >> I think you can achieve what you want with something like:
>> >>
>> >> options datestyle=dmy;
>> >> data have;
>> >> informat dt1 dt2 anydtdtm17.;
>> >> input dt1 dt2;
>> >> minutes=timepart(dt2)-timepart(dt1);
>> >> cards;
>> >> 25/01/10:07:10:25 25/01/10:07:11:25
>> >> ;
>> >>
>> >> HTH,
>> >> Art
>> >> ----------
>> >> On Feb 25, 6:14 am, nick <nickcorbin0...(a)googlemail.com> wrote:
>> >> > hi, if i want to find the difference between two dates i can
convert
>> >> > them to SAS dates using the YYMMDD8. format and then subtract one
from
>> >> > the other.
>> >> >
>> >> > i'd like to find the time interval between two observations in
>> >> > minutes. my raw data is in the format DD/MM/YYYY HH:MM:SS, i.e.
>> >> > 25/01/10 07:11:25. is it possible to convert this with a format to
a
>> >> > SAS time?
>> >> >
>> >> > thanks for your help,
>> >> >
>> >> > nick
>> >>
From: Arthur Tabachneck on
OK .. I was definitely wrong .. those were definitely seconds and not
minutes. Good thing I typically don't have to work with time data!

Art
--------
On Thu, 25 Feb 2010 12:03:13 -0500, Arthur Tabachneck
<art297(a)NETSCAPE.NET> wrote:

>Dan,
>
>I'll be the first to admit that I NEVER work with time data, but the
>following are the results I got when I ran the code:
>
>options datestyle=dmy;
>data have;
> informat dt1 dt2 anydtdtm17.;
> input dt1 dt2;
> format t1 t2 time8.;
> t1=timepart(dt1);
> t2=timepart(dt2);
> minutes=timepart(dt2)-timepart(dt1);
> cards;
>25/01/10:07:10:25 25/01/10:07:11:25
>;
>
>proc print data=have;
>run;
>
>Obs dt1 dt2 t1
>t2 minutes
>
> 1 1580022625 1580022685 7:10:25 7:11:25 60
>
>Art
>-------
>On Thu, 25 Feb 2010 08:41:45 -0800, Nordlund, Dan (DSHS/RDA)
><NordlDJ(a)DSHS.WA.GOV> wrote:
>
>>Art,
>>
>>But that result was 60 seconds, not minutes, unless I am reading the time
>wrong.
>>
>>Dan
>>
>>Daniel J. Nordlund
>>Washington State Department of Social and Health Services
>>Planning, Performance, and Accountability
>>Research and Data Analysis Division
>>Olympia, WA 98504-5204
>>
>>
>>> -----Original Message-----
>>> From: SAS(r) Discussion [mailto:SAS-L(a)LISTSERV.UGA.EDU] On Behalf Of
>>> Arthur Tabachneck
>>> Sent: Thursday, February 25, 2010 6:52 AM
>>> To: SAS-L(a)LISTSERV.UGA.EDU
>>> Subject: Re: Converting a timestamp to a SAS time
>>>
>>> Mark,
>>>
>>> Take a look at the example from my post earlier today. The result was
>60
>>> and no division was needed.
>>>
>>> options datestyle=dmy;
>>> data have;
>>> informat dt1 dt2 anydtdtm17.;
>>> input dt1 dt2;
>>> minutes=timepart(dt2)-timepart(dt1);
>>> cards;
>>> 25/01/10:07:10:25 25/01/10:07:11:25
>>> ;
>>>
>>> Art
>>> ------
>>> On Thu, 25 Feb 2010 08:48:07 -0500, Mark Miller <mdhmiller(a)GMAIL.COM>
>>> wrote:
>>>
>>> >Just like for a pair of SAS <date> vars or SAS <time> vars,
>>> >the difference between a pair of SAS <datetime> vars
>>> >can be computed directly by subtraction
>>> > i.e. <datetime1 - datetime2>
>>> >The difference is in seconds.
>>> >Divide by 60 to get minutes.
>>> >
>>> >... Mark Miller
>>> >
>>> >On Thu, Feb 25, 2010 at 7:43 AM, Arthur Tabachneck
>>> <art297(a)netscape.net>wrote:
>>> >
>>> >> Nick,
>>> >>
>>> >> I think you can achieve what you want with something like:
>>> >>
>>> >> options datestyle=dmy;
>>> >> data have;
>>> >> informat dt1 dt2 anydtdtm17.;
>>> >> input dt1 dt2;
>>> >> minutes=timepart(dt2)-timepart(dt1);
>>> >> cards;
>>> >> 25/01/10:07:10:25 25/01/10:07:11:25
>>> >> ;
>>> >>
>>> >> HTH,
>>> >> Art
>>> >> ----------
>>> >> On Feb 25, 6:14 am, nick <nickcorbin0...(a)googlemail.com> wrote:
>>> >> > hi, if i want to find the difference between two dates i can
>convert
>>> >> > them to SAS dates using the YYMMDD8. format and then subtract one
>from
>>> >> > the other.
>>> >> >
>>> >> > i'd like to find the time interval between two observations in
>>> >> > minutes. my raw data is in the format DD/MM/YYYY HH:MM:SS, i.e.
>>> >> > 25/01/10 07:11:25. is it possible to convert this with a format to
>a
>>> >> > SAS time?
>>> >> >
>>> >> > thanks for your help,
>>> >> >
>>> >> > nick
>>> >>