[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sas-l
Subject:    Re: What TIME is it?
From:       John Whittington <johnw () MAG-NET ! CO ! UK>
Date:       1997-05-30 22:54:33
[Download RAW message or body]

On Fri, 30 May 1997, Kimberly LeBouton <klebouton@AMERHONDA.COM> wrote:

>I'm having problems reading in time data.  My flat file stores the data
>similar to the program below.   (Note:  My flat file cannot be altered.)
>The output follows with the incorrect results.
>
> /*** Program ***/
>data test;
>   format time time11.2;
>   input time time11.2;
>  datalines;
>1:05:56.44
>6:32.93
>;
>run;
>
>proc print;
>run;
>
>OBS     TIME
>1               1:05:56.44
>2               6:32:33.00
>
>As you can see, my 6 minute time has now become 6 hours.
>
>I realize that I can read in the time data as character, and then check
>lengths and pad the shorter value, but I was hoping for something a little
>easier.  Has anyone run into this, and how did you solve the problem?

Kimberley, I suspect that 'character' method is your only option, for there
is no way that poor SAS can be expected to know the intention of the shorter
value - don't forget that the time11.2 informat will happily accept decimal
points instead of colons, so that:

  1.05.56.44 would be read as the same as 1:05:56.44

That being the case, there really is no way that the informat can 'know'
that the first figure in your shorter value is meant to be minutes, not hours.

If you have values of varying physical length, I would also suggest that you
should add a colon modifier before your time11.2 informat - and certainly if
there are any following variables to be read.

Regards,

John

-----------------------------------------------------------
Dr John Whittington,        Voice:      +44 1296 730225
Mediscience Services        Fax:        +44 1296 738893
Twyford Manor, Twyford,     E-mail:     johnw@mag-net.co.uk
Buckingham  MK18 4EL, UK    CompuServe: 100517,3677
-----------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic