|
On Dec 29, 2008, at 8:02 pm, Howard Schreier wrote:
> Interesting. Why the "current" day? It could be any day, possibly
> one not
> indicated.
Correct. I suspect it was easier to write that way. Perhaps the
editors felt that a simple "value representing the number of seconds
since midnight", without mentioning days, lacked a certain je ne sais
quoi.
> It could be not specific to a particular day (eg, answer to the
> question "what time do you usually awaken?"). Why the limit of
> 86,400? A
> time value may report a duration rather than a time of day (eg,
> answer to
> the question "how long will it take you to get from your home to the
> SAS
> Global Forum?").
It's probably worth mentioning somewhere that TOD. prints a time
modulo 24 hours, and time. prints the complete time.
=====
1 data _null_;
2 t = 200000;
3 put t=tod5. t=time.;
4 run;
t=07:33 t=55:33:20
=====
--
Jack Hamilton
jfh@alumni.stanford.org
Videtis illam spirare libertatis auram
On Dec 29, 2008, at 8:02 pm, Howard Schreier wrote:
> On Mon, 29 Dec 2008 19:21:43 -0800, Jack Hamilton <jfh@STANFORDALUMNI.ORG
> >
> wrote:
>
>> <http://support.sas.com/onlinedoc/913/docMainpage.jsp> says:
>>
>> SAS time value
>>
>> is a value representing the number of seconds since midnight
>> of the current day. SAS time values are between 0 and 86400.
>
> Interesting. Why the "current" day? It could be any day, possibly
> one not
> indicated. It could be not specific to a particular day (eg, answer
> to the
> question "what time do you usually awaken?"). Why the limit of
> 86,400? A
> time value may report a duration rather than a time of day (eg,
> answer to
> the question "how long will it take you to get from your home to the
> SAS
> Global Forum?").
>
>>
>> SAS datetime value
>>
>> is a value representing the number of seconds between
>> January 1, 1960 and an hour/minute/second within a specified
>> date.
>>
>> So datetime values for January 1, 1960 will be in the same range as
>> time values for 00:00:00 to 24:00:00. As long as your values are in
>> that range, you'll be OK.
>>
>> If you have a value greater than 24 hours, though, and you want to
>> display it in hours:minutes:seconds (or hours:minutes), you're out of
>> luck with TOD:
>>
>> =====
>> 1 data _null_;
>> 2 t = '23:59:59't;
>> 3 t2 = t + 100;
>> 4 put t=tod5. t2=tod5.;
>> 5 run;
>>
>> t=23:59 t2=00:01
>> ======
>>
>>
>>
>> --
>> Jack Hamilton
>> jfh@alumni.stanford.org
>> Videtis illam spirare libertatis auram
>>
>>
>>
>>
>>
>> On Dec 29, 2008, at 5:06 pm, John Whittington wrote:
>>
>>> At 19:26 29/12/2008 -0500, Ian Whitlock wrote:
>>>> John,
>>>>
>>>> You wanted a time format with leading 0's.
>>>>
>>>> The TOD format has been suggested, but it works with DATETIME
>>>> values
>>>> not TIME values. If your variable is time then you may have to
>>>> roll
>>>> your own format.
>>>
>>> Ian, that's what I thought, but when two people suggested TOD, I
>>> thought I ought to try it - and it appears to work fine (with TIME,
>>> as well as DATETIME, values):
>>>
>>> 21036 data _null_ ;
>>> 21037 mytime = '07:59't ;
>>> 21038 put "mytime = " mytime tod5. ;
>>> 21039 run ;
>>>
>>> mytime = 07:59
>>>
>>> I wonder if there are some risks in doing this (i.e. situations in
>>> which it doesn't work as desired)?
>>>
>>>> PS: It has been a long time. Glad your back.
>>>
>>> Thanks. It's good to be in contract with you again, too. I've
>>> never actually been 'away', in terms of reading SAS-L, but life has
>>> been so hectic for longer than I care to remember that I've had
>>> little time to actually contribute. My occasional appearances these
>>> days tend to be when I need help, rather than am offering it - which
>>> is a bit parasitic, but I live in hope of the fact that there will
>>> soon be more than 24 hours in a day, such that I'll be able to be a
>>> bit more conspicuous and contributive again!
>>>
>>> Kind Regards,
>>>
>>>
>>> John
>>>
>>> ----------------------------------------------------------------
>>> Dr John Whittington, Voice: +44 (0) 1296 730225
>>> Mediscience Services Fax: +44 (0) 1296 738893
>>> Twyford Manor, Twyford, E-mail: John.W@mediscience.co.uk
>>> Buckingham MK18 4EL, UK
>>> ----------------------------------------------------------------
|