|Date: ||Fri, 5 Nov 1999 18:16:50 -0800|
|Reply-To: ||"Berryhill, Tim" <TWB2@PGE.COM>|
|Sender: ||"SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>|
|From: ||"Berryhill, Tim" <TWB2@PGE.COM>|
|Subject: ||Re: A Time check poll|
|Content-Type: ||text/plain; charset="iso-8859-1"|
OK. The input is 4 characters which you plan to interpret as a two digit
hour value and a two digit minute value. May I assume hours and minutes
less than 10 will be padded with zeros? Define an informat:
RETAIN FMTNAME "TIMTIME" START "????" TYPE "I";
DO HOUR=0 TO 23;
DO MINUTE=0 TO 59;
LABEL=HOUR*60*60 + MINUTE*60;
PROC FORMAT CNTLIN=CNTLIN;
INPUT TIME TIMTIME.;
> From: California Doll[SMTP:vwilkins@MY-DEJA.COM]
> Reply To: California Doll
> Sent: Friday, November 05, 1999 5:19 PM
> To: SAS-L@LISTSERV.UGA.EDU
> Subject: Re: A Time check poll
> It doesn't stop at 2400.....
> 1 data;
> 2 time24 = hms(25,0,0);
> 3 format time24 hhmm5.;
> 4 put time24=;
> 5 run;
> NOTE: The data set WORK.DATA1 has 1 observations and 1 variables.
> NOTE: The DATA statement used 1.76 seconds.
> I have not seen a SAS function or informat that will error, give a note
> or a null value on an incorrect clock time with out a lot of extra
> coding. I would like a SIMPLE one line assignment that if the time
> values is missing then this means that the values is either missing or
> an incorrect time value. It works with dates such as:
> 19 data;
> 20 format tdate mmddyy10.;
> 21 date='12/12/1999';
> 22 tdate=input(date, ?? mmddyy10.);
> 23 put tdate=;
> 24 date='25/12/1999';
> 25 tdate=input(date, ?? mmddyy10.);
> 26 put tdate=;
> 27 run;
> NOTE: The data set WORK.DATA4 has 1 observations and 2 variables.
> NOTE: The DATA statement used 1.1 seconds.
> I guess this will change nothing in the work I am doing....
> California Doll
> It takes time to be a success,
> but time is all it takes.
> - Anonymous
> In article <000D5431.C21292@westat.com>,
> ABELSOR <ABELSOR@WESTAT.COM> wrote:
> > Well, I stand corrected. However, the SAS function HMS does not
> (according to
> > TFM) accept an hour greater than 23. A test contradicts this, though.
> > 1 data;
> > 2 time24 = hms(24,0,0);
> > 3 format time24 hhmm5.;
> > 4 put time24=;
> > 5 run;
> > TIME24=24:00
> > NOTE: The data set WORK.DATA1 has 1 observations and 1 variables.
> > NOTE: The DATA statement used 0.28 seconds.
> > So, I conclude that any solution to this problem will have to take
> 2400 as a
> > valid value.
> > Bob Abelson
> > Westat
> > ____________________Reply Separator____________________
> > Subject: Re: A Time check poll
> > Author: "CUMMING; GORDON (PB)" <GC6872@MSG.PACBELL.COM>
> > Date: 11/04/1999 1:43 PM
> > I was brought up under the belief that time went as follows
> > 23:59:59.99, 24:00:00.00, 00:00:00.01 and with rounding 23:59,
> > 24:00, 00:00 depending on the resolution of your clock. Most
> > clock displays ignore the 24:00 as it comes by so fast and why
> > add extra work for a perfect clock. If you need it why not use
> > an analog timepiece. So for all purposes 23:59 < 24:00 < 00:00
> > in other words 24:00 does not equal 00:00 mathematically.
> > _gordon
> > > After talking with many of the people I work with about this, I
> > > I would come to the newgroup with many different views. Given a
> > > character variable (mytime) that is 4 chars long containing time
> > > (hhmm) how would you check for valid clock time (24 hour clock).
> > > obvious answer is to strip out the hours and minutes and check each
> > > valid values (if 0 > hour > 24 or if 0 > mins > 59 then ERROR
> > > but I would like to take a pole on the different methods used. Some
> > > here have used methods that allow an hour of 25...and I never had an
> > > hour of 25 on my clock. Remember this is clock time not elapsed
> > >
> > > Regards,
> > > Vicki aka California Doll
> > > The great doing of little things makes the great life.
> > > - Eugenia Price
> Sent via Deja.com http://www.deja.com/
> Before you buy.