Hi All,
Here is my dataset. The rule is as follows:
Please see the data 'Want'. Admin1 or the first administration always has to occur between 12/15/2019 – 3/15/2020. Therefore the admin1 date is missing for ID#1. Same scenario with ID#5 where both admin dates occur after 3/15/2020. I also want to combine the characters in the Drug and the RR variables.
Data: Have
ID
Drug
Admin
RR
1
a
7/27/2020
IVES
2
b
2/15/2020
SubCu
3
a
3/22/2020
SubCu
4
a
1/13/2020
SubCu
4
b
4/20/2020
SubCu
4
c
7/20/2020
SubCu
5
a
4/19/2020
SubCu
5
b
7/19/2020
SubCu
6
a
1/19/2020
SubCu
6
b
7/17/2020
SubCu
7
c
12/27/2019
SubCu
7
d
6/26/2020
SubCu
8
a
3/12/2020
SubCu
8
b
9/12/2020
SubCu
8
c
9/21/2020
IV
8
c
10/12/2020
IV
Data: Want
ID
Drug
Admin1
RR
Admin2
Admin3
Admin4
1
2
b
2/15/2020
SubCu
3
a
3/22/2020
SubCu
4
a,b,c
1/13/2020
SubCu
4/20/2020
7/20/2020
5
6
a,b
1/19/2020
SubCu
7/17/2020
7
c,d
12/27/2019
SubCu
6/26/2020
8
a,b,c
3/12/2020
SubCu, IV
9/12/2020
9/21/2020
10/12/2020
Thank you!
... View more