dear all,
I have data about companies' addresses, zip code, and state as follows. Where begQ and endQ is the period during which the company was located in the referenced address.
There are some gaps in this data and it goes back to 2007 only. I want to create a panel dataset between 2000q1 and 2016q4 by using older quarter data to backfill (e.g. if 2006q4 address is missing, I need to use 2007q1 data) and the newest quarter to forward fill (e.g. if 2016q4 address is missing, I need to use 2016q3 data).
Desired dataset should look as follows:
Thank you for help
Gad
I have data about companies' addresses, zip code, and state as follows. Where begQ and endQ is the period during which the company was located in the referenced address.
There are some gaps in this data and it goes back to 2007 only. I want to create a panel dataset between 2000q1 and 2016q4 by using older quarter data to backfill (e.g. if 2006q4 address is missing, I need to use 2007q1 data) and the newest quarter to forward fill (e.g. if 2016q4 address is missing, I need to use 2016q3 data).
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int id long zip str48 address str2 state str6(begq endq) byte n 1034 7024 "1 executive dr" "nj" "2007q2" "2007q2" 3 1034 8807 "grande commons 440 u s highway 22 east 3rd floor" "nj" "2007q4" "2013q3" 3 1034 7940 "5 giralda farms" "nj" "2014q1" "2016q1" 3 1037 18951 "1900 am drive" "pa" "2007q2" "2013q1" 1 1038 64105 "920 main st" "mo" "2007q2" "2016q1" 1 1039 10016 "one park avenue" "ny" "2007q2" "2012q4" 1 1040 10604 "777 westchester avenue" "ny" "2007q2" "2011q1" 2 1040 23227 "p o box 15060" "va" "2011q2" "2011q2" 2 1041 80901 "p o box 370" "co" "2007q2" "2010q2" 2 1041 85040 "3414 south 5th street" "az" "2011q1" "2012q2" 2 end
Desired dataset should look as follows:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Thank you for help
Gad
Comment