I am trying to identify factories across different years of a survey by matching their opening and closing values of revenues across the years. For instance, I would like to match a factory in 2016 to one in 2017 if closing value of revenues of the 2016 factory matches the opening value of revenues of the 2017 factory by more than four digits. Ideally, I would like to create a unique factory id for each firm in the dataset across different years based on this method of matching. However, I am struggling to find a good method of doing this on Stata. Here's the example dataset for opening and closing value of revenues and the year of observations in a cross-section I have.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input double(Gross_Value_Open Gross_Value_close) str2 yr 285500 285500 "18" 1968320 1968320 "18" 2883103 2883103 "18" 0 0 "18" 0 0 "18" 0 0 "18" 330562 330562 "18" 0 0 "18" 5181985 5181985 "18" 5467485 5467485 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 385532133 385532133 "18" 855290260 857421969 "18" 9685935601 9688947511 "18" 10189593 10189593 "18" 6721413 8634653 "18" 0 0 "18" 111680964 113480013 "18" 989361 0 "18" 10669817831 10678673739 "18" 11056339325 11064205872 "18" 98106836 98106836 "18" 26185170300 26220664950 "18" 8775443140 8795672110 "18" 18355645 19692255 "18" 35912157 36565245 "18" 0 0 "18" 83387939 92060659 "18" 113843764 87494681 "18" 35098269181 35164655219 "18" 35310219781 35350256736 "18" 207197502 214289244 "18" 6387941152 6402391051 "18" 3035609506 3140446236 "18" 6305228 9879936 "18" 4243459 6170145 "18" 0 0 "18" 76507429 83701241 "18" 1975000 21715719 "18" 9510606774 9642588609 "18" 9719779276 9878593572 "18" 656188809 658439710 "18" 1414723666 1469209900 "18" 20150412653 20175284625 "18" 16386879 16220952 "18" 8380107 8362111 "18" 0 0 "18" 56196585 67704339 "18" 79793147 264568486 "18" 21646099890 21736781927 "18" 22382081846 22659790123 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 5450849 5450849 "18" 183502992 211025141 "18" 649899863 691422106 "18" 4845761 5575225 "18" 0 0 "18" 0 0 "18" 165935 173735 "18" 0 0 "18" 838414551 908196207 "18" 843865400 913647056 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" 0 0 "18" end
Warmest regards,
Eddy
0 Response to Create an identification variable for a panel dataset based on opening and closing values across years
Post a Comment