Hello,
I'm trying to create a dummy for the following Panel below. The data describes different companies, with their HQ Address, City and a yearly variable that goes from 2010 - 2018.
What I'm trying to do is a dummy that equals 0 if the company has not changed HQ from the past year, and equal to 1 if there has been a change.
I've read a few of the FAQ's about dummies and they've helped get a better understanding, but I still haven't got a clear idea how to tell stata that for a specifiec company year, to check if the value from the past year is the same.
The dataex is below. I believe we will have no changes in this specific example, but in the bigger set there should be some.
I'm trying to create a dummy for the following Panel below. The data describes different companies, with their HQ Address, City and a yearly variable that goes from 2010 - 2018.
What I'm trying to do is a dummy that equals 0 if the company has not changed HQ from the past year, and equal to 1 if there has been a change.
I've read a few of the FAQ's about dummies and they've helped get a better understanding, but I still haven't got a clear idea how to tell stata that for a specifiec company year, to check if the value from the past year is the same.
The dataex is below. I believe we will have no changes in this specific example, but in the bigger set there should be some.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str6 gvkey str88 conm str66 HQ str100 city float(year hqchange) "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2010 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2011 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2012 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2013 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2014 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2015 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2016 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2017 0 "001004" "AAR CORP" "One AAR Place, 1100 North Wood Dale Road" "Wood Dale" 2018 0 "001013" "ADC TELECOMMUNICATIONS INC" "13625 Technology Drive" "Eden Prairie" 2010 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2010 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2011 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2012 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2013 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2014 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2015 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2016 0 "001045" "AMERICAN AIRLINES GROUP INC" "4333 Amon Carter Boulevard" "Fort Worth" 2017 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2010 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2011 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2012 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2013 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2014 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2015 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2016 0 "001050" "CECO ENVIRONMENTAL CORP" "14651 North Dallas Parkway, Suite 500" "Dallas" 2017 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2010 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2010 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2011 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2011 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2012 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2012 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2013 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2013 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2014 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2014 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2015 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2015 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2016 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2016 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2017 0 "001062" "ASA GOLD AND PRECIOUS METALS" "400 South El Camino Real, Suite 710" "San Mateo" 2017 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2010 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2011 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2012 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2013 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2014 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2015 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2016 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2017 0 "001072" "AVX CORP" "One AVX Boulevard" "Fountain Inn" 2018 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2010 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2011 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2012 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2013 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2014 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2015 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2016 0 "001075" "PINNACLE WEST CAPITAL CORP" "400 North 5th Street" "Phoenix" 2017 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2010 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2011 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2012 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2013 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2014 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2015 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2016 0 "001076" "AARON'S INC" "400 Galleria Parkway SE, Suite 300" "Atlanta" 2017 0 "001078" "ABBOTT LABORATORIES" "100 Abbott Park Road" "Abbott Park" 2010 0 "001078" "ABBOTT LABORATORIES" "100 Abbott Park Road" "Abbott Park" 2011 0 "001078" "ABBOTT LABORATORIES" "100 Abbott Park Road" "Abbott Park" 2012 0 end
Comment