Hi all,
I would like to create cycle windows for variables that contain several 'day' timepoints within one cycle.
So, I have values that look like this:
Visit
DATE
C1 Day 1
01AUG2017
C1 Day 5
04AUG2017
C2 Day 1
15AUG2017
C2 Day 5
19AUG2017
C3 Day 1
25AUG2017
C3 Day 15
05SEP2017
C4 Day 1
10SEP2017
And I would like to create new variables that display the start and end date within each cycle- where the end date is one day before the start of the next cycle. New variables: Cycle, Cycle Start, Cycle End. I'm not sure how to get the end date. Maybe with lag or something? Any help is greatly appreciated!!
This is the logic...
Visit
DATE
CYCLE
CYCLE START
CYCLE END
C1 Day 1
01AUG2017
Cycle 1
01AUG2015
14AUG2017
C1 Day 5
04AUG2017
Cycle 1
01AUG2015
14AUG2015
C2 Day 1
15AUG2017
Cycle 2
15AUG2017
24AUG2017
C2 Day 5
19AUG2017
Cycle 2
15AUG2017
24AUG2017
C3 Day 1
25AUG2017
Cycle 3
25AUG2017
09SEP2017
C3 Day 15
05SEP2017
Cycle 3
25AUG2017
09SEP2017
C4 Day 1
10SEP2017
but this is how it should look so I can join to other tables:
CYCLE
CYCLE_START
CYCLE_END
C1
01AUG2015
14AUG2017
C2
15AUG2017
24AUG2017
C3
25AUG2017
09SEP2017
Here is where I started for the start date... data want set have (keep=patient visit vsdat); if scan(visit,3)='1' then do; cycle_start=date; Cycle=scan(visit,1);
... View more