Separate shifts within date time variable
Posted by parisec on
URL: http://spssx-discussion.165.s1.nabble.com/Separate-shifts-within-date-time-variable-tp5740995.html
Hi all,
I have data where i need to compute 4 separate groups based on dates and times of when an order was placed.
The first 2 groups are easy since they are based just on date of order.
compute status = $sysmis.
if orderdatetime lt Date.DMY(30,11,2019) status = 0.
if orderdatetime ge Date.DMY(01,12,2019) and orderdatetime le Date.DMY(04,06,2020) status = 1.
The next 2 groups have the same date range (Date.DMY ge (05,06,2020)) but they needed to be divided into Shift 1 and Shift 2:
Shift 1 = 1100 - 2300
Shift 2 = 2301 - 1059
Do I first need to extract out the time from the date so that i have both an orderdate and ordertime?
Or is there a way i can do this with the current orderdatetime variable?
Thanks much.
Carol