| Date: | Wed, 7 Nov 2007 12:43:25 -0500 |
| Reply-To: | Florio Arguillas <foa2@CORNELL.EDU> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Florio Arguillas <foa2@CORNELL.EDU> |
| Subject: | Re: SAS Day-Time Conversion Question |
|
| In-Reply-To: | <7367b4e20711070901n59b42eecga03903dc7c1cae5d@mail.gmail.co m> |
| Content-Type: | text/plain; charset="us-ascii"; format=flowed |
|---|
Hi data_null_;
Thanks for confirming my suspicion. And Thank You for the DHMS and
the TIME10 format combo. The result of this combination is exactly
what I wanted in the end.
Best regards,
Florio
At 12:01 PM 11/7/2007, data _null_, wrote:
>As far as I know there is no INFORMAT for that purpose. You can do as
>you suggest convert DAYS to seconds and add to time. DHMS can be used
>for this purpose.
>
>81 data _null_;
>82 infile cards dlm='d ';
>83 input days time:time8.;
>84 duration = dhms(max(0,days),0,0,time);
>85 format time time8. duration time10.;
>86 put (_all_)(=);
>87 cards;
>
>days=2 time=6:30:20 duration=54:30:20
>days=. time=3:02:35 duration=3:02:35
>days=36 time=20:34:26 duration=884:34:26
>
>
>On Nov 7, 2007 10:42 AM, Florio Arguillas <foa2@cornell.edu> wrote:
> > Hi Everyone,
> >
> > Do you know of a way to convert a time value that is in the following
> > format:
> >
> > 2d 06:30:20
> > 03:02:35
> > 36d 20:34:26
> >
> >
> > to a SAS time value? I've been combing the documentation and I've found
> > lots of info about how to convert to HH:MM:SS but nothing that will
> > interpret the days (i.e. "2d") or anything that includes any time period
> > larger than 24 hours. I am tempted to just split the day and time
> > component and multiply the day component by 60*60*24 (the total number of
> > seconds in a day) because this field is from a column-delimited (fixed
> > width) data, but maybe there is a much simpler way.
> >
> > Thanks in advance for your help.
> >
> > Best regards,
> >
> > Florio
> >
|