Hello everyone
I’m trying to define some rules on a dataset that comes from a regulator. I provided an example below.
Let me apologies firstly if I create any sort of confusion with an issue which I've been facing recently with this dataset. Unfortunately the data are a bit messy on how they are aggregated and I'm trying to clean them in the best way.
My main goal is to create a new panel with:
1. The variable time dimension should be daily and has not to have any gap from January 2018 till now.
2. For each day and id of the new time dimension, the new adnt applicable has to be the value contained in the variable adnt_old with the following rules:
When reporting_date_start is 1st January 2017 and reporting_date_end is 31th December 2017, then the value contained in the variable adnt_old will be applied for the new variable adnt_applicable from 1st January 2018 to 31th March 2019 (of the new time dimension variable). And also, there might be different adnt_old with same reporting period and isin. My intention is always to pick the value of adnt_old when the variable daily_filedate is missing
When reporting_date_start is 1st January 2018 and reporting_date_end is 31th December 2018, then the value contained in the variable adnt_old will be applied for the new adnt_applicable from 1st April 2019 to 31th March 2020 (of the new time dimension variable). Here, I want to track when adnt_old is changing but just when it happened in a daily_filedate between (1st April 2019 to 31th March 2020). With of course same reporting_date_ start and end (2018)
Otherwise I ignore the change (if for example the daily_ filedate is in year 2021),
When reporting_date_start is 1st January 2019 and reporting_date_end is 31th December 2019, then the value contained in the variable adnt_old will be applied for the new adnt_applicable from 1st April 2020 to 31th March 2021. Same as point before, I want to track when adnt_old is changing but just when it happened in a daily_file date between (1st April 2020 to 31th March 2021) with of course same reporting_date_ start and end (2019)
I acknowledge that I might have created confusion in explaining as well as the final goal might be a bit challenging but it would be wonderful if someone has any tip for that.
Thanks a lot in advance for the time and kindness.
I’m trying to define some rules on a dataset that comes from a regulator. I provided an example below.
Let me apologies firstly if I create any sort of confusion with an issue which I've been facing recently with this dataset. Unfortunately the data are a bit messy on how they are aggregated and I'm trying to clean them in the best way.
My main goal is to create a new panel with:
- Id (isin in this case)
- a new variable that identifies the time dimension
- and a new variable named adnt_applicable
1. The variable time dimension should be daily and has not to have any gap from January 2018 till now.
2. For each day and id of the new time dimension, the new adnt applicable has to be the value contained in the variable adnt_old with the following rules:
When reporting_date_start is 1st January 2017 and reporting_date_end is 31th December 2017, then the value contained in the variable adnt_old will be applied for the new variable adnt_applicable from 1st January 2018 to 31th March 2019 (of the new time dimension variable). And also, there might be different adnt_old with same reporting period and isin. My intention is always to pick the value of adnt_old when the variable daily_filedate is missing
When reporting_date_start is 1st January 2018 and reporting_date_end is 31th December 2018, then the value contained in the variable adnt_old will be applied for the new adnt_applicable from 1st April 2019 to 31th March 2020 (of the new time dimension variable). Here, I want to track when adnt_old is changing but just when it happened in a daily_filedate between (1st April 2019 to 31th March 2020). With of course same reporting_date_ start and end (2018)
Otherwise I ignore the change (if for example the daily_ filedate is in year 2021),
When reporting_date_start is 1st January 2019 and reporting_date_end is 31th December 2019, then the value contained in the variable adnt_old will be applied for the new adnt_applicable from 1st April 2020 to 31th March 2021. Same as point before, I want to track when adnt_old is changing but just when it happened in a daily_file date between (1st April 2020 to 31th March 2021) with of course same reporting_date_ start and end (2019)
I acknowledge that I might have created confusion in explaining as well as the final goal might be a bit challenging but it would be wonderful if someone has any tip for that.
Thanks a lot in advance for the time and kindness.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str12 isin float(daily_filedate reporting_date_start reporting_date_end adnt_old) "AEDFXA1EN018" . 20820 21184 30.73 "AEDFXA1EN018" 21519 20820 21184 30.733946 "AEDFXA1EN018" 21813 20820 21184 30.733946 "AEDFXA1EN018" 21575 20820 21184 30.733946 "AEDFXA1EN018" 21687 20820 21184 30.733946 "AEDFXA1EN018" 21736 20820 21184 30.733946 "AEDFXA1EN018" 21876 20820 21184 30.733946 "AEDFXA1EN018" 21666 20820 21184 30.733946 "AEDFXA1EN018" 21883 20820 21184 30.733946 "AEDFXA1EN018" 21428 20820 21184 30.733946 "AEDFXA1EN018" 21862 20820 21184 30.733946 "AEDFXA1EN018" 21463 20820 21184 30.733946 "AEDFXA1EN018" 21701 20820 21184 30.733946 "AEDFXA1EN018" 21414 20820 21184 30.733946 "AEDFXA1EN018" 21680 20820 21184 30.733946 "AEDFXA1EN018" 21421 20820 21184 30.733946 "AEDFXA1EN018" 21603 20820 21184 30.733946 "AEDFXA1EN018" 21505 20820 21184 30.733946 "AEDFXA1EN018" 21848 20820 21184 30.733946 "AEDFXA1EN018" 21841 20820 21184 30.733946 "AEDFXA1EN018" 21435 20820 21184 30.733946 "AEDFXA1EN018" 21568 20820 21184 30.733946 "AEDFXA1EN018" 21582 20820 21184 30.733946 "AEDFXA1EN018" 21771 20820 21184 30.733946 "AEDFXA1EN018" 21764 20820 21184 30.733946 "AEDFXA1EN018" 21652 20820 21184 30.733946 "AEDFXA1EN018" 21778 20820 21184 30.733946 "AEDFXA1EN018" 21820 20820 21184 30.733946 "AEDFXA1EN018" 21659 20820 21184 30.733946 "AEDFXA1EN018" 21456 20820 21184 30.733946 "AEDFXA1EN018" 21827 20820 21184 30.733946 "AEDFXA1EN018" 21631 20820 21184 30.733946 "AEDFXA1EN018" 21596 20820 21184 30.733946 "AEDFXA1EN018" 21792 20820 21184 30.733946 "AEDFXA1EN018" 21743 20820 21184 30.733946 "AEDFXA1EN018" 21442 20820 21184 30.733946 "AEDFXA1EN018" 21449 20820 21184 30.733946 "AEDFXA1EN018" 21638 20820 21184 30.733946 "AEDFXA1EN018" 21715 20820 21184 30.733946 "AEDFXA1EN018" 21512 20820 21184 30.733946 "AEDFXA1EN018" 21477 20820 21184 30.733946 "AEDFXA1EN018" 21799 20820 21184 30.733946 "AEDFXA1EN018" 21869 20820 21184 30.733946 "AEDFXA1EN018" 21722 20820 21184 30.733946 "AEDFXA1EN018" 21526 20820 21184 30.733946 "AEDFXA1EN018" 21393 20820 21184 30.733946 "AEDFXA1EN018" 21610 20820 21184 30.733946 "AEDFXA1EN018" 21484 20820 21184 30.733946 "AEDFXA1EN018" 21834 20820 21184 30.733946 "AEDFXA1EN018" 21708 20820 21184 30.733946 "AEDFXA1EN018" 21645 20820 21184 30.733946 "AEDFXA1EN018" 21498 20820 21184 30.733946 "AEDFXA1EN018" 21806 20820 21184 30.733946 "AEDFXA1EN018" 21750 20820 21184 30.733946 "AEDFXA1EN018" 21561 20820 21184 30.733946 "AEDFXA1EN018" 21554 20820 21184 30.733946 "AEDFXA1EN018" 21491 20820 21184 30.733946 "AEDFXA1EN018" 21540 20820 21184 30.733946 "AEDFXA1EN018" 21400 20820 21184 30.733946 "AEDFXA1EN018" 21785 20820 21184 30.733946 "AEDFXA1EN018" 21729 20820 21184 30.733946 "AEDFXA1EN018" 21589 20820 21184 30.733946 "AEDFXA1EN018" 21547 20820 21184 30.733946 "AEDFXA1EN018" 21757 20820 21184 30.733946 "AEDFXA1EN018" 21855 20820 21184 30.733946 "AEDFXA1EN018" 21407 20820 21184 30.733946 "AEDFXA1EN018" 21673 20820 21184 30.733946 "AEDFXA1EN018" 22485 21550 21914 .00391 "AEDFXA1EN018" 22296 21550 21914 .00391 "AEDFXA1EN018" 22527 21550 21914 .00391 "AEDFXA1EN018" 22548 21550 21914 .00391 "AEDFXA1EN018" 22415 21550 21914 .00391 "AEDFXA1EN018" 22373 21550 21914 .00391 "AEDFXA1EN018" 22492 21550 21914 .00391 "AEDFXA1EN018" 22541 21550 21914 .00391 "AEDFXA1EN018" 22520 21550 21914 .00391 "AEDFXA1EN018" 22359 21550 21914 .00391 "AEDFXA1EN018" 22436 21550 21914 .00391 "AEDFXA1EN018" 22443 21550 21914 .00391 "AEDFXA1EN018" 22394 21550 21914 .00391 "AEDFXA1EN018" 22303 21550 21914 .00391 "AEDFXA1EN018" 22506 21550 21914 .00391 "AEDFXA1EN018" 22352 21550 21914 .00391 "AEDFXA1EN018" 22513 21550 21914 .00391 "AEDFXA1EN018" 22324 21550 21914 .00391 "AEDFXA1EN018" 22331 21550 21914 .00391 "AEDFXA1EN018" 22464 21550 21914 .00391 "AEDFXA1EN018" 22380 21550 21914 .00391 "AEDFXA1EN018" 22555 21550 21914 .00391 "AEDFXA1EN018" 22408 21550 21914 .00391 "AEDFXA1EN018" 22345 21550 21914 .00391 "AEDFXA1EN018" 22366 21550 21914 .00391 "AEDFXA1EN018" 22450 21550 21914 .00391 "AEDFXA1EN018" 22499 21550 21914 .00391 "AEDFXA1EN018" 22478 21550 21914 .00391 "AEDFXA1EN018" 22387 21550 21914 .00391 "AEDFXA1EN018" 22422 21550 21914 .00391 "AEDFXA1EN018" 22338 21550 21914 .00391 "AEDFXA1EN018" 22401 21550 21914 .00391 "AEDFXA1EN018" 22429 21550 21914 .00391 end format %d daily_filedate format %td reporting_date_start format %td reporting_date_end
Comment