Hello everyone,
Using Stata 16.
I'm working with election data, from 2006 to 2018. For each election year (every 4 years), I have a political party variable (*_inc) which takes values 1 or 0, if that party became part of the governing board in that year, or not, respectively.
The data looks as it follows:
I want to create a variable to express whether a party is an incumbent. So, I want to know, for example, if in 2010 the "M" party was an incumbent in a certain kommun, based on it's M_inc variable.being 1 or 0 in 2006.
I have tried to use - rangestat - but I do not fully understand the command.
Any help?
br,
Pedro
Using Stata 16.
I'm working with election data, from 2006 to 2018. For each election year (every 4 years), I have a political party variable (*_inc) which takes values 1 or 0, if that party became part of the governing board in that year, or not, respectively.
The data looks as it follows:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year str23 kommun_name byte(M_inc C_inc FP_inc KD_inc S_inc V_inc MP_inc SD_inc OVR_inc) str4 kommun_code double M_inc_10 2006 "Upplands väsby" 1 1 1 1 0 0 0 0 0 "0114" 1 2006 "Vallentuna" 1 1 1 1 0 0 0 0 0 "0115" 1 2006 "Österåker" 1 1 1 1 0 0 0 0 1 "0117" 1 2006 "Värmdö" 1 1 1 1 0 0 0 0 0 "0120" 1 2006 "Järfälla" 1 1 1 1 0 0 0 0 0 "0123" 1 2006 "Ekerö" 1 1 1 1 0 0 0 0 0 "0125" 1 2006 "Huddinge" 1 0 1 1 0 0 0 0 1 "0126" 1 2006 "Botkyrka" 0 0 0 0 1 1 1 0 0 "0127" 0 2006 "Salem" 1 1 1 1 0 0 0 0 0 "0128" 1 2006 "Haninge" 1 1 1 1 0 0 1 0 0 "0136" 1 2006 "Tyresö" 1 1 1 1 0 0 0 0 0 "0138" 1 2006 "Upplands-Bro" 1 1 1 1 0 0 0 0 0 "0139" 1 2006 "Nykvarn" 1 1 0 0 0 0 0 0 1 "0140" 1 2006 "Täby" 1 1 1 1 0 0 0 0 0 "0160" 1 2006 "Danderyd" 1 0 0 1 0 0 0 0 0 "0162" 1 2006 "Sollentuna" 1 1 1 1 0 0 0 0 0 "0163" 1 2006 "Stockholm" 1 1 1 1 0 0 0 0 0 "0180" 1 2006 "Södertälje" 0 0 0 0 1 1 1 0 0 "0181" 0 2006 "Nacka" 1 0 1 1 0 0 0 0 0 "0182" 1 2006 "Sundbyberg" 1 1 1 1 0 0 0 0 0 "0183" 1 2006 "Solna" 1 0 1 1 0 0 0 0 0 "0184" 1 2006 "Lidingö" 1 0 1 0 0 0 0 0 0 "0186" 1 2006 "Vaxholm" 1 1 1 1 0 0 0 0 0 "0187" 1 2006 "Norrtälje" 1 1 1 1 0 0 0 0 0 "0188" 1 2006 "Sigtuna" 0 1 0 0 1 0 1 0 0 "0191" 0 2006 "Nynäshamn" 0 0 1 0 1 0 0 0 0 "0192" 0 2006 "Håbo" 1 0 1 1 0 0 0 0 1 "0305" 1 2006 "Älvkarleby" 0 0 0 0 1 1 0 0 0 "0319" 0 2006 "Knivsta" 1 1 1 1 0 0 0 0 0 "0330" 1 2006 "Heby" 1 0 1 0 1 1 0 0 0 "0331" 1 2006 "Tierp" 0 0 0 0 1 1 0 0 0 "0360" 0 2006 "Uppsala" 1 1 1 1 0 0 0 0 0 "0380" 1 2006 "Enköping" 1 1 1 1 0 0 0 0 0 "0381" 1 2006 "Östhammar" 1 1 1 1 0 0 1 0 1 "0382" 1 2006 "Vingåker" 0 0 0 0 1 0 0 0 0 "0428" 0 2006 "Gnesta" 1 1 1 1 0 0 0 0 0 "0461" 1 2006 "Nyköping" 1 1 1 1 0 0 1 0 0 "0480" 1 2006 "Oxelösund" 0 0 0 0 1 0 0 0 0 "0481" 0 2006 "Flen" 0 0 0 0 1 0 0 0 1 "0482" 0 2006 "Katrineholm" 0 0 0 0 1 0 0 0 0 "0483" 0 2006 "Eskilstuna" 0 0 0 0 1 1 0 0 0 "0484" 0 2006 "Strängnäs" 1 1 1 1 0 0 0 0 1 "0486" 1 2006 "Trosa" 1 1 1 1 0 0 0 0 0 "0488" 1 2006 "Ödeshög" 1 1 1 1 0 0 0 0 0 "0509" 1 2006 "Ydre" 1 1 0 1 1 0 0 0 1 "0512" 1 2006 "Kinda" 1 1 1 1 0 0 0 0 0 "0513" 1 2006 "Boxholm" 0 0 0 0 1 0 0 0 0 "0560" 0 2006 "Åtvidaberg" 1 0 0 0 1 0 0 0 0 "0561" 1 2006 "Finspång" 0 0 0 0 1 1 0 0 0 "0562" 0 2006 "Valdemarsvik" 1 1 1 1 0 0 0 0 0 "0563" 1 2006 "Linköping" 1 1 1 1 0 0 0 0 0 "0580" 1 2006 "Norrköping" 0 0 0 0 1 1 1 0 0 "0581" 0 2006 "Söderköping" 1 1 1 1 0 0 0 0 0 "0582" 1 2006 "Motala" 1 1 1 1 0 0 1 0 1 "0583" 1 2006 "Vadstena" 1 0 0 0 1 0 0 0 0 "0584" 1 2006 "Mjölby" 1 1 1 1 0 0 0 0 1 "0586" 1 2006 "Aneby" 1 1 1 1 0 0 0 0 0 "0604" 1 2006 "Gnosjö" 1 1 1 1 0 0 0 0 0 "0617" 1 2006 "Mullsjö" 1 1 1 1 0 0 0 0 1 "0642" 1 2006 "Habo" 1 1 1 1 1 0 0 0 0 "0643" 1 2006 "Gislaved" 1 1 1 1 0 0 0 0 0 "0662" 1 2006 "Vaggeryd" 1 1 1 1 0 0 0 0 0 "0665" 1 2006 "Jönköping" 1 1 1 1 0 0 1 0 0 "0680" 1 2006 "Nässjö" 0 0 0 0 1 1 0 0 1 "0682" 0 2006 "Värnamo" 1 1 1 1 0 0 0 0 0 "0683" 1 2006 "Sävsjö" 1 1 1 1 0 0 0 0 0 "0684" 1 2006 "Vetlanda" 1 1 1 1 0 0 0 0 0 "0685" 1 2006 "Eksjö" 1 1 1 1 0 0 0 0 0 "0686" 1 2006 "Tranås" 1 1 1 1 0 0 0 0 0 "0687" 1 2006 "Uppvidinge" 1 1 1 1 0 0 0 0 0 "0760" 1 2006 "Lessebo" 0 0 0 0 1 0 0 0 0 "0761" 0 2006 "Tingsryd" 1 1 1 1 0 0 0 0 0 "0763" 1 2006 "Alvesta" 0 1 1 0 1 0 0 0 0 "0764" 0 2006 "Älmhult" 1 1 1 1 0 0 1 0 0 "0765" 1 2006 "Markaryd" 1 1 1 1 0 0 0 0 0 "0767" 1 2006 "Växjö" 1 1 1 1 0 0 0 0 0 "0780" 1 2006 "Ljungby" 0 0 0 0 1 0 0 0 0 "0781" 0 2006 "Högsby" 1 1 1 1 0 0 1 0 1 "0821" 1 2006 "Torsås" 0 0 0 0 1 1 0 0 1 "0834" 0 2006 "Mörbylånga" 1 1 1 1 0 0 1 0 1 "0840" 1 2006 "Hultsfred" 0 0 0 0 1 1 0 0 0 "0860" 0 2006 "Mönsterås" 1 1 1 1 0 0 0 0 0 "0861" 1 2006 "Emmaboda" 0 0 0 0 1 1 0 0 0 "0862" 0 2006 "Kalmar" 0 0 0 0 1 1 1 0 0 "0880" 0 2006 "Nybro" 0 0 0 0 1 1 1 0 0 "0881" 0 2006 "Oskarshamn" 0 0 0 0 1 1 0 0 0 "0882" 0 2006 "Västervik" 1 1 1 1 0 0 0 0 1 "0883" 1 2006 "Vimmerby" 1 1 1 1 0 0 0 0 0 "0884" 1 2006 "Borgholm" 1 1 1 1 0 0 1 0 0 "0885" 1 2006 "Gotland" 1 1 1 1 0 0 0 0 0 "0980" 1 2006 "Olofström" 0 0 0 0 1 0 0 0 0 "1060" 0 2006 "Karlskrona" 1 1 1 1 0 0 1 0 0 "1080" 1 2006 "Ronneby" 0 0 1 1 1 0 0 0 0 "1081" 0 2006 "Karlshamn" 0 0 1 1 1 0 0 0 0 "1082" 0 2006 "Sölvesborg" 0 0 0 0 1 1 0 0 1 "1083" 0 2006 "Svalöv" 1 0 0 0 1 0 0 0 0 "1214" 1 2006 "Staffanstorp" 1 0 1 1 0 0 0 0 0 "1230" 1 2006 "Burlöv" 1 0 0 0 1 0 0 0 0 "1231" 1 2006 "Vellinge" 1 0 0 0 0 0 0 0 0 "1233" 1 2006 "Östra Göinge" 0 0 0 0 1 0 0 0 0 "1256" 0 end
I want to create a variable to express whether a party is an incumbent. So, I want to know, for example, if in 2010 the "M" party was an incumbent in a certain kommun, based on it's M_inc variable.being 1 or 0 in 2006.
I have tried to use - rangestat - but I do not fully understand the command.
Any help?
br,
Pedro
Comment