Prev: proc tabulate
Next: Max file size for ODS RTF output.
From: db on 5 Jan 2010 16:28 Hi, I have a variable called Time with following format and would like to extract hour:time only so I can group by hour_time. Could you tell me how to extract hour and time from this Time variable ? Thanks Time 23:59:58.345 23:59:59.234 0:00:00.306 0:00:00.373 0:00:00.373 .. .. .. 01:00:00.765
From: db on 5 Jan 2010 16:29 Hi, I have a variable called Time with following format and would like to extract hour:min only so I can group by hour_min. Could you tell me how to extract hour and min from this Time variable ? Thanks Time 23:59:58.345 23:59:59.234 0:00:00.306 0:00:00.373 0:00:00.373 .. .. .. 01:00:00.765
From: Joe Matise on 5 Jan 2010 16:32 If it's actually a TIME variable [a number] and not a char variable, you can use hour() or whatnot [there's one for minute() and second() as well] to extract it. hourvar = hour(timevar); No idea what else you mean by extract time, so perhaps you will want to post back to the list with more specific desired results [ie, what you actually want to get back in the same form as you posted your data] if this isn't enough. -Joe On Tue, Jan 5, 2010 at 3:28 PM, db <daronnebonneau(a)gmail.com> wrote: > Hi, I have a variable called Time with following format and would like > to extract hour:time only so I can group by hour_time. > Could you tell me how to extract hour and time from this Time > variable ? Thanks > > Time > 23:59:58.345 > 23:59:59.234 > 0:00:00.306 > 0:00:00.373 > 0:00:00.373 > . > . > . > 01:00:00.765 >
From: Arthur Tabachneck on 5 Jan 2010 18:07 Daronne, Are you looking for something like:? data have; informat time time12.3; format time time12.3; input time; cards; 23:59:58.345 23:59:59.234 0:00:00.306 0:00:00.373 0:00:00.373 .. .. .. 01:00:00.765 ; data want; set have; hour_min=hms(hour(time),minute(time),0); format hour_min hhmm5.; run; Art -------- On Tue, 5 Jan 2010 13:29:20 -0800, db <daronnebonneau(a)GMAIL.COM> wrote: >Hi, I have a variable called Time with following format and would like >to extract hour:min only so I can group by hour_min. >Could you tell me how to extract hour and min from this Time >variable ? Thanks > >Time >23:59:58.345 >23:59:59.234 >0:00:00.306 >0:00:00.373 >0:00:00.373 >. >. >. >01:00:00.765
|
Pages: 1 Prev: proc tabulate Next: Max file size for ODS RTF output. |