devdatalab / shrug-public

Issue tracking for the Socioeconomic High-resolution Rural-Urban Geographic Platform for India (SHRUG)
29 stars 1 forks source link

shrid2 not uniquely identified by state and district keys #13

Open mathurshreya95 opened 1 year ago

mathurshreya95 commented 1 year ago

I'm looking at the Population Census keys data specifically the shrid_pc01dist_key and shrid2 does not seem to be uniquely identified by the state and district keys. If shrid2 is at the smallest geographic unit, they should be contained within a district, I assumed.

Screenshot 2023-10-10 183212

binrkmv commented 5 months ago

* try using the following steps


In responce to Unique identification of shrid2 in shrid_pc01dist_key.dta


//The same can be followed in the different key files if for the same issues

capture cd "%path" use "%path\shrid_pc01dist_key.dta", clear

codebook shrid2 duplicates tag shrid2, gen(dupshrid) codebook dupshrid sort dupshrid shrid2

br dupshrid shrid2 if dupshrid >=1 br dupshrid shrid2 pc01_state_id pc01_district_id if dupshrid >=1 // there is mismatch in the distid in the shrid2 // format shrid2 (yr-stateid-distid- ....) // solution

replace shrid2 = "11-03-08-48-254-36979" if pc01_state_id == 3 & pc01_district_id ==8 & shrid =="11-03-048-00254-036979" replace shrid2 = "11-03-17-48-254-36979" if pc01_state_id == 3 & pc01_district_id ==17 & shrid =="11-03-048-00254-036979" replace shrid2 = "11-05-04-59-294-800299" if pc01_state_id == 5 & pc01_district_id ==4 & shrid =="11-05-059-00294-800299" replace shrid2 = "11-05-06-59-294-800299" if pc01_state_id == 5 & pc01_district_id ==6 & shrid =="11-05-059-00294-800299" replace shrid2 = "11-06-02-70-358-57182" if pc01_state_id == 6 & pc01_district_id ==2 & shrid =="11-06-070-00358-057182" replace shrid2 = "11-06-01-70-358-57182" if pc01_state_id == 6 & pc01_district_id ==1 & shrid =="11-06-070-00358-057182" replace shrid2 = "11-06-01-70-359-57381" if pc01_state_id == 6 & pc01_district_id ==1 & shrid =="11-06-070-00359-057381" replace shrid2 = "11-06-02-70-359-57381" if pc01_state_id == 6 & pc01_district_id ==2 & shrid =="11-06-070-00359-057381" replace shrid2 = "11-06-07-74-373-59330" if pc01_state_id == 6 & pc01_district_id ==7 & shrid =="11-06-074-00373-059330" replace shrid2 = "11-06-06-74-373-59330" if pc01_state_id == 6 & pc01_district_id ==6 & shrid =="11-06-074-00373-059330" replace shrid2 = "11-08-11-109-534-78139" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-109-00534-078139" replace shrid2 = "11-08-12-109-534-78139" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-109-00534-078139" replace shrid2 = "11-08-11-109-534-78162" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-109-00534-078162" replace shrid2 = "11-08-12-109-534-78162" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-109-00534-078162" replace shrid2 = "11-08-12-109-534-78173" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-109-00534-078173" replace shrid2 = "11-08-11-109-534-78173" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-109-00534-078173" replace shrid2 = "11-08-11-109-534-78176" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-109-00534-078176" replace shrid2 = "11-08-12-109-534-78176" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-109-00534-078176" replace shrid2 = "11-08-11-109-537-78831" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-109-00537-078831" replace shrid2 = "11-08-12-109-537-78831" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-109-00537-078831" replace shrid2 = "11-08-12-110-538-79002" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079002" replace shrid2 = "11-08-11-110-538-79002" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079002" replace shrid2 = "11-08-12-110-538-79004" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079004" replace shrid2 = "11-08-11-110-538-79004" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079004" replace shrid2 = "11-08-12-110-538-79018" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079018" replace shrid2 = "11-08-11-110-538-79018" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079018" replace shrid2 = "11-08-12-110-538-79025" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079025" replace shrid2 = "11-08-11-110-538-79025" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079025" replace shrid2 = "11-08-12-110-538-79026" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079026" replace shrid2 = "11-08-11-110-538-79026" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079026" replace shrid2 = "11-08-12-110-538-79033" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079033" replace shrid2 = "11-08-11-110-538-79033" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079033" replace shrid2 = "11-08-12-110-538-79039" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079039" replace shrid2 = "11-08-11-110-538-79039" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079039" replace shrid2 = "11-08-11-110-538-79072" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079072" replace shrid2 = "11-08-12-110-538-79072" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079072" replace shrid2 = "11-08-12-110-538-79115" if pc01_state_id == 8 & pc01_district_id ==12 & shrid =="11-08-110-00538-079115" replace shrid2 = "11-08-11-110-538-79115" if pc01_state_id == 8 & pc01_district_id ==11 & shrid =="11-08-110-00538-079115" replace shrid2 = "11-08-28-125-652-800601" if pc01_state_id == 8 & pc01_district_id ==28 & shrid =="11-08-125-00652-800601" replace shrid2 = "11-08-27-125-652-800601" if pc01_state_id == 8 & pc01_district_id ==27 & shrid =="11-08-125-00652-800601" replace shrid2 = "11-08-31-128-672-800615" if pc01_state_id == 8 & pc01_district_id ==31 & shrid =="11-08-128-00672-800615" replace shrid2 = "11-08-30-128-672-800615" if pc01_state_id == 8 & pc01_district_id ==30 & shrid =="11-08-128-00672-800615" replace shrid2 = "11-08-30-128-674-103031" if pc01_state_id == 8 & pc01_district_id ==30 & shrid =="11-08-128-00674-103031" replace shrid2 = "11-08-31-128-674-103031" if pc01_state_id == 8 & pc01_district_id ==31 & shrid =="11-08-128-00674-103031" replace shrid2 = "11-10-11-213-1166-226079" if pc01_state_id == 10 & pc01_district_id ==11 & shrid =="11-10-213-01166-226079" replace shrid2 = "11-10-35-213-1166-226079" if pc01_state_id == 10 & pc01_district_id ==35 & shrid =="11-10-213-01166-226079" replace shrid2 = "11-10-14-216-1199-228045" if pc01_state_id == 10 & pc01_district_id ==14 & shrid =="11-10-216-01199-228045" replace shrid2 = "11-10-19-216-1199-228045" if pc01_state_id == 10 & pc01_district_id ==19 & shrid =="11-10-216-01199-228045" replace shrid2 = "11-10-31-221-1302-237308" if pc01_state_id == 10 & pc01_district_id ==31 & shrid =="11-10-221-01302-237308" replace shrid2 = "11-10-19-221-1302-237308" if pc01_state_id == 10 & pc01_district_id ==19 & shrid =="11-10-221-01302-237308" replace shrid2 = "11-10-22-224-1329-238844" if pc01_state_id == 10 & pc01_district_id ==22 & shrid =="11-10-224-01329-238844" replace shrid2 = "11-10-31-224-1329-238844" if pc01_state_id == 10 & pc01_district_id ==31 & shrid =="11-10-224-01329-238844" replace shrid2 = "11-12-04-256-1711-265656" if pc01_state_id == 12 & pc01_district_id ==4 & shrid =="11-12-256-01711-265656" replace shrid2 = "11-12-05-256-1711-265656" if pc01_state_id == 12 & pc01_district_id ==5 & shrid =="11-12-256-01711-265656" replace shrid2 = "11-14-06-275-1873-801469" if pc01_state_id == 14 & pc01_district_id ==6 & shrid =="11-14-275-01873-801469" replace shrid2 = "11-14-04-275-1873-801469" if pc01_state_id == 14 & pc01_district_id ==4 & shrid =="11-14-275-01873-801469" replace shrid2 = "11-14-07-277-1881-801487" if pc01_state_id == 14 & pc01_district_id ==7 & shrid =="11-14-277-01881-801487" replace shrid2 = "11-14-06-277-1881-801487" if pc01_state_id == 14 & pc01_district_id ==6 & shrid =="11-14-277-01881-801487" replace shrid2 = "11-14-06-277-1882-801492" if pc01_state_id == 14 & pc01_district_id ==6 & shrid =="11-14-277-01882-801492" replace shrid2 = "11-14-07-277-1882-801492" if pc01_state_id == 14 & pc01_district_id ==7 & shrid =="11-14-277-01882-801492" replace shrid2 = "11-15-03-281-1896-271013" if pc01_state_id == 15 & pc01_district_id ==3 & shrid =="11-15-281-01896-271013" replace shrid2 = "11-15-01-281-1896-271013" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-281-01896-271013" replace shrid2 = "11-15-08-281-1898-271119" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-281-01898-271119" replace shrid2 = "11-15-01-281-1898-271119" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-281-01898-271119" replace shrid2 = "11-15-02-282-1900-271162" if pc01_state_id == 15 & pc01_district_id ==2 & shrid =="11-15-282-01900-271162" replace shrid2 = "11-15-01-282-1900-271162" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-282-01900-271162" replace shrid2 = "11-15-08-282-1901-271178" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-282-01901-271178" replace shrid2 = "11-15-02-282-1901-271178" if pc01_state_id == 15 & pc01_district_id ==2 & shrid =="11-15-282-01901-271178" replace shrid2 = "11-15-02-282-1901-271184" if pc01_state_id == 15 & pc01_district_id ==2 & shrid =="11-15-282-01901-271184" replace shrid2 = "11-15-08-282-1901-271184" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-282-01901-271184" replace shrid2 = "11-15-01-283-1903-271222" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-283-01903-271222" replace shrid2 = "11-15-03-283-1903-271222" if pc01_state_id == 15 & pc01_district_id ==3 & shrid =="11-15-283-01903-271222" replace shrid2 = "11-15-01-283-1903-271224" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-283-01903-271224" replace shrid2 = "11-15-03-283-1903-271224" if pc01_state_id == 15 & pc01_district_id ==3 & shrid =="11-15-283-01903-271224" replace shrid2 = "11-15-01-287-1919-271769" if pc01_state_id == 15 & pc01_district_id ==1 & shrid =="11-15-287-01919-271769" replace shrid2 = "11-15-08-287-1919-271769" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-287-01919-271769" replace shrid2 = "11-15-03-288-1921-271829" if pc01_state_id == 15 & pc01_district_id ==3 & shrid =="11-15-288-01921-271829" replace shrid2 = "11-15-08-288-1921-271829" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-288-01921-271829" replace shrid2 = "11-15-08-288-1921-271830" if pc01_state_id == 15 & pc01_district_id ==8 & shrid =="11-15-288-01921-271830" replace shrid2 = "11-15-03-288-1921-271830" if pc01_state_id == 15 & pc01_district_id ==3 & shrid =="11-15-288-01921-271830" replace shrid2 = "11-17-03-293-1962-272957" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01962-272957" replace shrid2 = "11-17-01-293-1962-272957" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01962-272957" replace shrid2 = "11-17-01-293-1962-272971" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01962-272971" replace shrid2 = "11-17-03-293-1962-272971" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01962-272971" replace shrid2 = "11-17-01-293-1962-272987" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01962-272987" replace shrid2 = "11-17-03-293-1962-272987" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01962-272987" replace shrid2 = "11-17-03-293-1963-273140" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01963-273140" replace shrid2 = "11-17-01-293-1963-273140" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01963-273140" replace shrid2 = "11-17-01-293-1963-273214" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01963-273214" replace shrid2 = "11-17-03-293-1963-273214" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01963-273214" replace shrid2 = "11-17-01-293-1963-273236" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01963-273236" replace shrid2 = "11-17-03-293-1963-273236" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01963-273236" replace shrid2 = "11-17-01-293-1965-273592" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01965-273592" replace shrid2 = "11-17-03-293-1965-273592" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01965-273592" replace shrid2 = "11-17-03-293-1966-273662" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01966-273662" replace shrid2 = "11-17-01-293-1966-273662" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01966-273662" replace shrid2 = "11-17-01-293-1966-273727" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01966-273727" replace shrid2 = "11-17-03-293-1966-273727" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01966-273727" replace shrid2 = "11-17-03-293-1966-273797" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-293-01966-273797" replace shrid2 = "11-17-01-293-1966-273797" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-293-01966-273797" replace shrid2 = "11-17-04-294-1970-274493" if pc01_state_id == 17 & pc01_district_id ==4 & shrid =="11-17-294-01970-274493" replace shrid2 = "11-17-02-294-1970-274493" if pc01_state_id == 17 & pc01_district_id ==2 & shrid =="11-17-294-01970-274493" replace shrid2 = "11-17-03-295-1975-275800" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-295-01975-275800" replace shrid2 = "11-17-01-295-1975-275800" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-295-01975-275800" replace shrid2 = "11-17-01-295-1976-275902" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-295-01976-275902" replace shrid2 = "11-17-03-295-1976-275902" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-295-01976-275902" replace shrid2 = "11-17-01-295-1976-275952" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-295-01976-275952" replace shrid2 = "11-17-03-295-1976-275952" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-295-01976-275952" replace shrid2 = "11-17-03-295-1976-275985" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-295-01976-275985" replace shrid2 = "11-17-01-295-1976-275985" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-295-01976-275985" replace shrid2 = "11-17-01-295-1976-276001" if pc01_state_id == 17 & pc01_district_id ==1 & shrid =="11-17-295-01976-276001" replace shrid2 = "11-17-03-295-1976-276001" if pc01_state_id == 17 & pc01_district_id ==3 & shrid =="11-17-295-01976-276001" replace shrid2 = "11-17-02-296-1982-277016" if pc01_state_id == 17 & pc01_district_id ==2 & shrid =="11-17-296-01982-277016" replace shrid2 = "11-17-04-296-1982-277016" if pc01_state_id == 17 & pc01_district_id ==4 & shrid =="11-17-296-01982-277016" replace shrid2 = "11-17-02-296-1982-277093" if pc01_state_id == 17 & pc01_district_id ==2 & shrid =="11-17-296-01982-277093" replace shrid2 = "11-17-04-296-1982-277093" if pc01_state_id == 17 & pc01_district_id ==4 & shrid =="11-17-296-01982-277093" replace shrid2 = "11-17-04-296-1982-277114" if pc01_state_id == 17 & pc01_district_id ==4 & shrid =="11-17-296-01982-277114" replace shrid2 = "11-17-02-296-1982-277114" if pc01_state_id == 17 & pc01_district_id ==2 & shrid =="11-17-296-01982-277114" replace shrid2 = "11-17-06-297-1987-278057" if pc01_state_id == 17 & pc01_district_id ==6 & shrid =="11-17-297-01987-278057" replace shrid2 = "11-17-05-297-1987-278057" if pc01_state_id == 17 & pc01_district_id ==5 & shrid =="11-17-297-01987-278057" replace shrid2 = "11-17-05-298-1995-278903" if pc01_state_id == 17 & pc01_district_id ==5 & shrid =="11-17-298-01995-278903" replace shrid2 = "11-17-06-298-1995-278903" if pc01_state_id == 17 & pc01_district_id ==6 & shrid =="11-17-298-01995-278903" replace shrid2 = "11-19-02-327-99999-801638" if pc01_state_id == 19 & pc01_district_id ==2 & shrid =="11-19-327-99999-801638" replace shrid2 = "11-19-01-327-99999-801638" if pc01_state_id == 19 & pc01_district_id ==1 & shrid =="11-19-327-99999-801638" replace shrid2 = "11-20-12-355-2589-362291" if pc01_state_id == 20 & pc01_district_id ==12 & shrid =="11-20-355-02589-362291" replace shrid2 = "11-20-13-355-2589-362291" if pc01_state_id == 20 & pc01_district_id ==13 & shrid =="11-20-355-02589-362291" replace shrid2 = "11-20-09-364-2696-374391" if pc01_state_id == 20 & pc01_district_id ==9 & shrid =="11-20-364-02696-374391" replace shrid2 = "11-20-14-364-2696-374391" if pc01_state_id == 20 & pc01_district_id ==14 & shrid =="11-20-364-02696-374391" replace shrid2 = "11-23-12-428-3460-802168" if pc01_state_id == 23 & pc01_district_id ==12 & shrid =="11-23-428-03460-802168" replace shrid2 = "11-23-40-428-3460-802168" if pc01_state_id == 23 & pc01_district_id ==40 & shrid =="11-23-428-03460-802168" replace shrid2 = "11-23-20-438-3539-802266" if pc01_state_id == 23 & pc01_district_id ==20 & shrid =="11-23-438-03539-802266" replace shrid2 = "11-23-25-438-3539-802266" if pc01_state_id == 23 & pc01_district_id ==25 & shrid =="11-23-438-03539-802266" replace shrid2 = "11-24-04-470-3746-508766" if pc01_state_id == 24 & pc01_district_id ==4 & shrid =="11-24-470-03746-508766" replace shrid2 = "11-24-03-470-3746-508766" if pc01_state_id == 24 & pc01_district_id ==3 & shrid =="11-24-470-03746-508766" replace shrid2 = "11-24-07-474-3785-511845" if pc01_state_id == 24 & pc01_district_id ==7 & shrid =="11-24-474-03785-511845" replace shrid2 = "11-24-05-474-3785-511845" if pc01_state_id == 24 & pc01_district_id ==5 & shrid =="11-24-474-03785-511845" replace shrid2 = "11-27-23-518-99999-802794" if pc01_state_id == 27 & pc01_district_id ==23 & shrid =="11-27-518-99999-802794" replace shrid2 = "11-27-22-518-99999-802794" if pc01_state_id == 27 & pc01_district_id ==22 & shrid =="11-27-518-99999-802794" replace shrid2 = "11-28-20-533-4370-802905" if pc01_state_id == 28 & pc01_district_id ==20 & shrid =="11-28-533-04370-802905" replace shrid2 = "11-28-02-533-4370-802905" if pc01_state_id == 28 & pc01_district_id ==2 & shrid =="11-28-533-04370-802905" replace shrid2 = "11-29-24-569-5523-608856" if pc01_state_id == 29 & pc01_district_id ==24 & shrid =="11-29-569-05523-608856" replace shrid2 = "11-29-16-569-5523-608856" if pc01_state_id == 29 & pc01_district_id ==16 & shrid =="11-29-569-05523-608856" replace shrid2 = "11-33-01-604-5708-629749" if pc01_state_id == 33 & pc01_district_id ==1 & shrid =="11-33-604-05708-629749" replace shrid2 = "11-33-03-604-5708-629749" if pc01_state_id == 33 & pc01_district_id ==3 & shrid =="11-33-604-05708-629749" replace shrid2 = "11-33-08-608-5743-803473" if pc01_state_id == 33 & pc01_district_id ==8 & shrid =="11-33-608-05743-803473" replace shrid2 = "11-33-09-608-5743-803473" if pc01_state_id == 33 & pc01_district_id ==9 & shrid =="11-33-608-05743-803473" replace shrid2 = "11-33-18-617-5789-636649" if pc01_state_id == 33 & pc01_district_id ==18 & shrid =="11-33-617-05789-636649" replace shrid2 = "11-33-07-617-5789-636649" if pc01_state_id == 33 & pc01_district_id ==7 & shrid =="11-33-617-05789-636649" replace shrid2 = "11-01-04-10-43-800013" if pc01_state_id == 1 & pc01_district_id ==4 & shrid =="11-01-010-00043-800013" replace shrid2 = "11-01-03-10-43-800013" if pc01_state_id == 1 & pc01_district_id ==3 & shrid =="11-01-010-00043-800013" replace shrid2 = "11-01-02-10-43-800013" if pc01_state_id == 1 & pc01_district_id ==2 & shrid =="11-01-010-00043-800013" replace shrid2 = "11-07-05-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==5 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-02-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==2 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-09-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==9 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-01-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==1 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-03-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==3 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-04-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==4 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-08-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==8 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-07-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==7 & shrid =="11-07-090-00431-800441" replace shrid2 = "11-07-06-90-431-800441" if pc01_state_id == 7 & pc01_district_id ==6 & shrid =="11-07-090-00431-800441"

// now shrid2 is unique

** save

save "%path\shrid_pc01dist_key_unique.dta", replace


* Thanks