Hi everyone,
From my dataset, I would like to keep only those IDs for which we have contracts that run between 1 January 2021 and November 2023 without interruption, please.
I want to keep the IDs that have no interruption during the interlude above (i.e. that remain in my sample from start to finish).
I don't want to keep the IDs that have some interruption or that enter in my sample later than 1 January 2021.
Here's a -dataex- as an example:
Thank you in advance for your help.
All the best,
Michael
From my dataset, I would like to keep only those IDs for which we have contracts that run between 1 January 2021 and November 2023 without interruption, please.
I want to keep the IDs that have no interruption during the interlude above (i.e. that remain in my sample from start to finish).
I don't want to keep the IDs that have some interruption or that enter in my sample later than 1 January 2021.
Here's a -dataex- as an example:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input long(id idcontrato) double(date_contract_start date_contract_end) 1253 1253 19100 19266 1253 1410 19267 22431 1253 1055841 22432 22645 1253 1815013 22646 22676 1253 1904434 22677 22735 1253 2413928 22736 23010 1253 2880202 23011 23100 1253 3189647 23101 . 2195 2195 19465 20458 2195 80657 20459 21258 2195 1365966 22544 22645 2195 1726472 22646 22676 2195 2073891 22677 22735 2195 2277485 22736 22918 2195 2613231 22919 23010 2195 2863016 23011 23100 2195 3175831 23101 23314 2195 3343382 23315 . 2239 2239 19477 21608 2239 351357 21609 21615 end format %td date_contract_start format %td date_contract_end
- -id- refers to household IDs,
- -idcontrato- refers to contract ID,
- -date_contract_start- is the beginning of a given contract,
- -date_contract_end- is the end of a given contract.
Thank you in advance for your help.
All the best,
Michael
Comment