```Date: Tue, 12 Mar 1996 15:21:57 PDT Reply-To: paul.crickard@JHUAPL.EDU Sender: "SAS(r) Discussion" From: paul.crickard@JHUAPL.EDU Organization: Johns Hopkins University Applied Physics Lab, Laurel, MD, USA Subject: Re: Help with Date Conversion SAS time values are in seconds of day and 12 hours is 43200 seconds. Supposing that time is formatted as such, if code = 'PM' and time < '12:00:00'T then time = time + 43200. If code = 'AM' and time >= '12:00:00'T then time = time - 43200 (this starts the day at 00:00:00). In article , writes: > Michael, > Off the top of my head I'd suggest: > > data new; > set old; > hour=hour(time); > min=minute(time); > sec=second(time); > if code='PM' then hour=hour+12; > time=hms(hour,min,sec); > run; > > > mbabyak@acpub.duke.edu (Michael Babyak) wrote: > >Dear SAS folks, > > > >I was wondering if anyone could offer us some advice on the > >following problem: > > > >We have two variables, one for time of day in hh:mm:ss > >format, which was entered in clock time (ie, 1 through 12 > >hours), and a second coded as AM or PM. We'd like to > >recode these two variables into one military time variable. > >Can anyone offer a way to do this? > > > >Many thanks in advance. > > > >Mike Babyak ```

Back to: Top of message | Previous page | Main SAS-L page