« Return to Thread: creating new variables
As the time is recorded as the number of seconds from midnight you could use:
RECODE t_of_day (Lowest thru 1800=1) (1801 thru 3600=2) (3601 thru 5400=3) INTO t_of_day_recoded.
Or with Visual binning to generate this:
* Visual Binning.
*t_of_day.
RECODE t_of_day (MISSING=COPY) (LO THRU 1=1) (LO THRU 25200=2) (LO THRU 27000=3) (LO THRU 28800=4)
(LO THRU HI=5) (ELSE=SYSMIS) INTO t_of_day_binned.
VARIABLE LABELS t_of_day_binned 't_of_day (Binned)'.
FORMATS t_of_day_binned (F5.0).
VALUE LABELS t_of_day_binned 1 '<= 0:00:01' 2 '0:00:02 - 7:00:00' 3 '7:00:01 - 7:30:00' 4
'7:30:01 - 8:00:00' 5 '8:00:01+'.
VARIABLE LEVEL t_of_day_binned (ORDINAL).
EXECUTE.
The advantage of visual binning is that you can put in times like 07:30:00 and it converts it to the required number of seconds !!
Best Wishes
John S. Lemon
Student Liaison Officer
Directorate of Information Technology (DIT) - University of Aberdeen
Edward Wright Building: Room G51
Tel: +44 1224 273350
Fax: +44 1224 273372
From: SPSSX(r) Discussion [mailto:SPSSX-L@...]
On Behalf Of abdelrhman elmubarak
Sent: Saturday, June 27, 2009 9:50 AM
To: SPSSX-L@...
Subject: recode time variable
Dear Listers
How to to recode a time variable as below
7:12 7:29 8:30
To 30 minutes time interval variable as below
70:01 - 7:30 =1
7:31 – 8:30 =2
Thanks in advance
Abdulrahman Yousef Elmubar
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy!
Try it!
« Return to Thread: creating new variables
| Free embeddable forum powered by Nabble | Forum Help |