Goodmorning Statalisters!
I have a tough problem.
Data Description
Here is a good example of one person in the dataset:
As you can see, the person with Pidm 70004813 has been solicited on 20 dates, and attended an event on 2 different dates (hence total of 22 rows for that Pidm).
*My goal is to sort through the solicitation dates (variable: final_decided_date), and for each event_date a Pidm has, I want to generate a copy of the closest final_decided_date after that event_date if there is one.
I would also like to generate another indicator variable which just marks if a final_decided_date was after any of their event dates (so basically just check if it was after their first event_date if they have any event_dates.)
I know how to check for the closest solicitation_date after an event_date if a Pidm only has ONE event_date, but not multiple.
Thank you!
I have a tough problem.
Data Description
- Pidm : a unique ID that is assigned to each individual in the dataset
- final_decided_date : the date that a solicitation was sent to an individual (each Pidm can have MANY solicitation dates)
- event_date : the date that an individual attended an event (each Pidm can have a couple event dates)
Here is a good example of one person in the dataset:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long Pidm float final_decided_date int event_date 70004813 17721 . 70004813 19275 . 70004813 19304 . 70004813 19464 . 70004813 19765 . 70004813 19765 . 70004813 19790 . 70004813 19790 . 70004813 19796 . 70004813 19796 . 70004813 19832 . 70004813 19832 . 70004813 20028 . 70004813 20049 . 70004813 20074 . 70004813 20079 . 70004813 20133 . 70004813 20210 . 70004813 20350 . 70004813 20399 . 70004813 . 20523 70004813 . 20573 end format %td final_decided_date format %td event_date
As you can see, the person with Pidm 70004813 has been solicited on 20 dates, and attended an event on 2 different dates (hence total of 22 rows for that Pidm).
*My goal is to sort through the solicitation dates (variable: final_decided_date), and for each event_date a Pidm has, I want to generate a copy of the closest final_decided_date after that event_date if there is one.
I would also like to generate another indicator variable which just marks if a final_decided_date was after any of their event dates (so basically just check if it was after their first event_date if they have any event_dates.)
I know how to check for the closest solicitation_date after an event_date if a Pidm only has ONE event_date, but not multiple.
Thank you!
Comment