From: Mark Miller on 21 Jan 2010 18:32 Points to consider Time8 format actually allows a decimal portion for fractions of a second as in Time13.4 Milliseconds are 1000th of second so if your second variable is milliseconds the corresponding display would be 00:45:28.0073 If the milliseconds field is always the fractional part ( always <=3D 0999) then you can probably use the SECOND function to extract the seconds from your Time variable then Add the milliseconds, and finally reconstruct the complete time using the HMS function as in TimeAll =3D HMS( Hour(myTime), Minute(myTime), (Second(myTime) + mSec/1000 ) ) ; .... Mark Miller On Thu, Jan 21, 2010 at 5:58 PM, Craig Johnson <cjohns38(a)gmail.com> wrote: > This is probably easy I=92m just not sure how to do it. I need a way to > concatenate two numeric time fields that are storing times. The first > variable stores the start time of an event in the HH:MM:SS format > (Time8.) Naturally, > the program we export from stores the milliseconds in a second variable i= n > best 12 format. To do any analyses we need them together. So, I need a > way tack on the MS to the first variable so I end up with something like > 00:45:28:73 rather than 00:45:28 and 73. > > > > Thoughts? >
From: Tom Abernathy on 21 Jan 2010 20:08 Time is already in seconds so just add the milliseconds as fractional time. 22 data _null_; 23 t='00:45:28't ; 24 ms=73; 25 t2=t + ms/1000; 26 format t t2 time12.3; 27 put (t ms t2) (=/); 28 run; t=0:45:28.000 ms=73 t2=0:45:28.073 On Jan 21, 6:32 pm, mdhmil...(a)GMAIL.COM (Mark Miller) wrote: > Points to consider > > Time8 format actually allows a decimal portion for fractions of a > second as in Time13.4 > > Milliseconds are 1000th of second so if your second variable is > milliseconds > the corresponding display would be 00:45:28.0073 > > If the milliseconds field is always the fractional part ( always <=3D > 0999) > then you can probably use the SECOND function to extract the seconds > from your Time variable then Add the milliseconds, and finally > reconstruct > the complete time using the HMS function as in > > TimeAll =3D HMS( Hour(myTime), Minute(myTime), (Second(myTime) + > mSec/1000 ) ) ; > > ... Mark Miller > > > > > > On Thu, Jan 21, 2010 at 5:58 PM, Craig Johnson <cjohn...(a)gmail.com> wrote: > > This is probably easy I=92m just not sure how to do it. I need a way to > > concatenate two numeric time fields that are storing times. The first > > variable stores the start time of an event in the HH:MM:SS format > > (Time8.) Naturally, > > the program we export from stores the milliseconds in a second variable i= > n > > best 12 format. To do any analyses we need them together. So, I need a > > way tack on the MS to the first variable so I end up with something like > > 00:45:28:73 rather than 00:45:28 and 73. > > > Thoughts?- Hide quoted text - > > - Show quoted text -
From: Craig Johnson on 22 Jan 2010 09:26 Thanks Tom and Mark! I figured someone would be able to help me out. :) On Thu, Jan 21, 2010 at 7:08 PM, Tom Abernathy <tom.abernathy(a)gmail.com>wrote: > Time is already in seconds so just add the milliseconds as fractional > time. > > 22 data _null_; > 23 t='00:45:28't ; > 24 ms=73; > 25 t2=t + ms/1000; > 26 format t t2 time12.3; > 27 put (t ms t2) (=/); > 28 run; > > t=0:45:28.000 > ms=73 > t2=0:45:28.073 > > > > On Jan 21, 6:32 pm, mdhmil...(a)GMAIL.COM (Mark Miller) wrote: > > Points to consider > > > > Time8 format actually allows a decimal portion for fractions of a > > second as in Time13.4 > > > > Milliseconds are 1000th of second so if your second variable is > > milliseconds > > the corresponding display would be 00:45:28.0073 > > > > If the milliseconds field is always the fractional part ( always > <=3D > > 0999) > > then you can probably use the SECOND function to extract the > seconds > > from your Time variable then Add the milliseconds, and finally > > reconstruct > > the complete time using the HMS function as in > > > > TimeAll =3D HMS( Hour(myTime), Minute(myTime), (Second(myTime) + > > mSec/1000 ) ) ; > > > > ... Mark Miller > > > > > > > > > > > > On Thu, Jan 21, 2010 at 5:58 PM, Craig Johnson <cjohn...(a)gmail.com> > wrote: > > > This is probably easy I=92m just not sure how to do it. I need a way > to > > > concatenate two numeric time fields that are storing times. The first > > > variable stores the start time of an event in the HH:MM:SS format > > > (Time8.) Naturally, > > > the program we export from stores the milliseconds in a second variable > i= > > n > > > best 12 format. To do any analyses we need them together. So, I need > a > > > way tack on the MS to the first variable so I end up with something > like > > > 00:45:28:73 rather than 00:45:28 and 73. > > > > > Thoughts?- Hide quoted text - > > > > - Show quoted text - >
|
Pages: 1 Prev: Weird naming convention with newfile=bygroup ? Next: update_with_history macro search |