Hi Stata users,
I have a dataset as shown below, where each household (hh_id) provides the time (start_date and end_date) they lived in a specific location (location) for the period 2015-2019. I want to create a set of variables, named fy*, that represent the number of days each household lived in each financial year. I plan to use these variables to match with financial year income data at a later stage.
Thank you very much in advance.
I have a dataset as shown below, where each household (hh_id) provides the time (start_date and end_date) they lived in a specific location (location) for the period 2015-2019. I want to create a set of variables, named fy*, that represent the number of days each household lived in each financial year. I plan to use these variables to match with financial year income data at a later stage.
Thank you very much in advance.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte hh_id str1 location int(start_date end_date fy_1415 fy_1516 fy_1617 fy_1718 fy_1819 fy_1920) 1 "A" 20166 20454 104 182 0 0 0 0 1 "B" 20455 21914 0 181 366 366 366 185 2 "C" 20166 21486 104 367 366 366 122 0 2 "D" 21487 21914 0 0 0 0 244 185 3 "E" 20166 21914 104 367 366 366 366 185 end format %td start_date format %td end_date

Comment