I have created a panel dataset based on election results (this is a fairly large dataset across 8 elections and I have only including a small portion of 3 election cycles here)
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int year str9 state str7 city str10(village winner) str9 votes 2000 "karnataka" "mysore" "thirumpete" "rajesha" "1000" 2000 "karnataka" "mysore" "narsipura" "vanaja" "850" 2000 "karnataka" "mysore" "patna" "kumara" "900" 2000 "karnataka" "mysore" "hd kote" "hitesh" "1989" 2005 "karnatak" "mysore" "tirumpete" "rajesha" "157" 2005 "karnatak" "mysore" "narsipur" "vikram" "1244" 2005 "karnatak" "mysore" "patna" "umayal" "234" 2005 "karnatak" "mysore" "hdkote" "amina bano" "999" 2010 "karnataka" "mysor e" "thirumpete" "rajesha" "134" 2010 "karnataka" "mysor e" "narsipura" "vanaja" "593" 2010 "karnataka" "mysor e" "patnaa" "amina bano" "unopposed" 2010 "karnataka" "mysor e" "hd kote" "muddassir" "1241" end
I need a panel that has a unique id for different villages, along with election winners over the years. However, due to variations in the spellings of the state, city and village, I am not able to think of a tractable way to do this.
Thanks!
0 Response to Generate Unique Group ID in a Panel Data with Spelling Variations
Post a Comment