Hello,
My goal is to assign the same unique ID to "agroup" and "aiso3c" values that share the same set of "id" and "prope". This is the dataset I have:
I am getting crazy. This is an example of the type of code I have in mind:
However, it does not work. Any help? Thank you!
My goal is to assign the same unique ID to "agroup" and "aiso3c" values that share the same set of "id" and "prope". This is the dataset I have:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str3 aiso3c str40 agroup str7 id str18 prope "MLI" "Arabe" "mey-MLI" "0.0277777777777778" "MLI" "Arabic" "mey-MLI" "0.0277777777777778" "MLI" "Bambara" "bam-MLI" "1" "MLI" "Bella" "taq-MLI" "0.25" "MLI" "Bella" "ttq-MLI" "0.25" "MLI" "Bobo" "bmq-MLI" "1" "MLI" "Bozo" "boo-MLI" "0.142857142857143" "MLI" "Bozo" "boz-MLI" "0.142857142857143" "MLI" "Bozo" "bzx-MLI" "0.142857142857143" "MLI" "Bozo" "bze-MLI" "0.571428571428571" "MLI" "Dafing" "rkm-MLI" "1" "MLI" "Dogon" "dkl-MLI" "0.0869565217391304" "MLI" "Dogon" "djm-MLI" "0.173913043478261" "MLI" "Dogon" "dbg-MLI" "0.0434782608695652" "MLI" "Dogon" "dds-MLI" "0.0869565217391304" "MLI" "Dogon" "dtm-MLI" "0.0434782608695652" "MLI" "Dogon" "dts-MLI" "0.0434782608695652" "MLI" "Dogon" "dtt-MLI" "0.0434782608695652" "MLI" "Dogon" "dtk-MLI" "0.173913043478261" "MLI" "Dogon" "dbu-MLI" "0.0869565217391304" "MLI" "French" "NA" "NA" "MLI" "Fulfulde/Peul" "ffm-MLI" "0.0833333333333333" "MLI" "Fulfulde/Peul" "fuf-MLI" "0.0833333333333333" "MLI" "Fulfulde/Peul" "fuc-MLI" "0.0833333333333333" "MLI" "Haoussa" "NA" "NA" "MLI" "Kakolo" "xkg-MLI" "1" "MLI" "Khasonk" "kao-MLI" "1" "MLI" "Khasonke" "kao-MLI" "1" "MLI" "Khassonke" "kao-MLI" "1" "MLI" "Malink" "bam-MLI" "0.16" "MLI" "Malink" "mwk-MLI" "0.02" "MLI" "Malink" "rkm-MLI" "0.06" "MLI" "Malink" "jad-MLI" "0.02" "MLI" "Malink" "mlq-MLI" "0.02" "MLI" "Malink" "kao-MLI" "0.02" "MLI" "Malink" "xkg-MLI" "0.02" "MLI" "Malinke" "bam-MLI" "0.16" "MLI" "Malinke" "mwk-MLI" "0.02" "MLI" "Malinke" "rkm-MLI" "0.06" "MLI" "Malinke" "jad-MLI" "0.02" "MLI" "Malinke" "mlq-MLI" "0.02" "MLI" "Malinke" "kao-MLI" "0.02" "MLI" "Malinke" "xkg-MLI" "0.02" "MLI" "Maure" "mey-MLI" "1" "MLI" "Mianka" "myk-MLI" "1" "MLI" "Mossi" "NA" "NA" "MLI" "Peugl/Fulfulde" "ffm-MLI" "0.0833333333333333" "MLI" "Peugl/Fulfulde" "fuf-MLI" "0.0833333333333333" "MLI" "Peugl/Fulfulde" "fuc-MLI" "0.0833333333333333" "MLI" "Peuhl" "ffm-MLI" "0.0833333333333333" "MLI" "Peuhl" "fuf-MLI" "0.0833333333333333" "MLI" "Peuhl" "fuc-MLI" "0.0833333333333333" "MLI" "Peulh / Fulfude" "ffm-MLI" "0.0833333333333333" "MLI" "Peulh / Fulfude" "fuf-MLI" "0.0833333333333333" "MLI" "Peulh / Fulfude" "fuc-MLI" "0.0833333333333333" "MLI" "Peulh/ Fulfulde" "ffm-MLI" "0.0833333333333333" "MLI" "Peulh/ Fulfulde" "fuf-MLI" "0.0833333333333333" "MLI" "Peulh/ Fulfulde" "fuc-MLI" "0.0833333333333333" "MLI" "Peulh/Fulfude" "ffm-MLI" "0.0833333333333333" "MLI" "Peulh/Fulfude" "fuf-MLI" "0.0833333333333333" "MLI" "Peulh/Fulfude" "fuc-MLI" "0.0833333333333333" "MLI" "Samogo" "bxw-MLI" "0.142857142857143" "MLI" "Samogo" "dux-MLI" "0.142857142857143" "MLI" "Samogo" "jow-MLI" "0.142857142857143" "MLI" "Samoko" "bxw-MLI" "0.142857142857143" "MLI" "Samoko" "dux-MLI" "0.142857142857143" "MLI" "Samoko" "jow-MLI" "0.142857142857143" "MLI" "Senufo" "myk-MLI" "0.160714285714286" "MLI" "Senufo" "spp-MLI" "0.0714285714285714" "MLI" "Senufo" "sep-MLI" "0.0178571428571429" "MLI" "Senufo" "shz-MLI" "0.0178571428571429" "MLI" "Senufo/ Mianka" "myk-MLI" "0.160714285714286" "MLI" "Senufo/ Mianka" "spp-MLI" "0.0714285714285714" "MLI" "Senufo/ Mianka" "sep-MLI" "0.0178571428571429" "MLI" "Senufo/ Mianka" "shz-MLI" "0.0178571428571429" "MLI" "Sonink" "snk-MLI" "1" "MLI" "Soninke" "snk-MLI" "1" "MLI" "Soninke / Sarakolle" "snk-MLI" "1" "MLI" "Soninke/ Sarakoll" "snk-MLI" "1" "MLI" "Soninke/Sarakole" "snk-MLI" "1" "MLI" "Sonrha" "khq-MLI" "0.2" "MLI" "Sonrha" "ses-MLI" "0.2" "MLI" "Sonrha" "dje-MLI" "0.1" "MLI" "Sonrha" "hmb-MLI" "0.1" "MLI" "Sonrha" "dsq-MLI" "0.1" "MLI" "Sonrhai" "khq-MLI" "0.2" "MLI" "Sonrhai" "ses-MLI" "0.2" "MLI" "Sonrhai" "dje-MLI" "0.1" "MLI" "Sonrhai" "hmb-MLI" "0.1" "MLI" "Sonrhai" "dsq-MLI" "0.1" "MLI" "Tamasheq" "taq-MLI" "0.25" "MLI" "Tamasheq" "ttq-MLI" "0.25" "MLI" "Wolof" "NA" "NA" "MLI" "Zerma" "dje-MLI" "1" end
Code:
sort aiso3c agroup id prope egen bg_ei = concat(id prope) sort aiso3c agroup bg_ei by aiso3c agroup: gen group_summary = group(bg_ei) bysort group_summary: gen unique_id = _n == 1
Comment