Hi Stata Community
I have a unique problem.
I have two string variables containing names of the villages; fplmis (village1) and training (village2).
For the variable village 1; there are 5500 observations and,
for the variable village2, there are only 1500 observations.
I want to create a new variable ‘match’ if the string in the variable village1 matches the string in the variable village2 (match==1 and nomatch ==0).
Regarding this I have following doubts:
The sequence of names in village1 and village2 are different owing to the difference in the number of observations. For example, a village named xxx may lie at 24th observation in variable village1, the same village may lie at 5th observation in village2. I want to match if a string in village1 matches with any observations in village2.
Below is the example of my Data
clear
input str36 fplmis str35 training
"Aagurli " "Chhijwar"
"Abhilaheda " "Shivrajpur"
"Agar " "Bhadawal"
"Agdal " "Balbhadragarh"
"Ajapura " "Deora 2"
"Ajgar " "Anjora"
"Ali " "Sanai"
"Ambodiya " "Khatkhari"
"Amroul " "Kalora"
"Andawa " "Dharnauda"
"Ankhwari " "Kherkhedi"
"Arniyagoad " "Geruari"
"Arusi " "Kumbhraj rural"
"Attar " "aron"
"Babri " "Sigora new"
"Badagau " " barsat new"
"badgoan " "Madagan mafi"
"Badgore " "Tijarpur"
"Badgyar " "Pachawali"
"Badjher " "Patulkhi"
I have a unique problem.
I have two string variables containing names of the villages; fplmis (village1) and training (village2).
For the variable village 1; there are 5500 observations and,
for the variable village2, there are only 1500 observations.
I want to create a new variable ‘match’ if the string in the variable village1 matches the string in the variable village2 (match==1 and nomatch ==0).
Regarding this I have following doubts:
The sequence of names in village1 and village2 are different owing to the difference in the number of observations. For example, a village named xxx may lie at 24th observation in variable village1, the same village may lie at 5th observation in village2. I want to match if a string in village1 matches with any observations in village2.
Below is the example of my Data
clear
input str36 fplmis str35 training
"Aagurli " "Chhijwar"
"Abhilaheda " "Shivrajpur"
"Agar " "Bhadawal"
"Agdal " "Balbhadragarh"
"Ajapura " "Deora 2"
"Ajgar " "Anjora"
"Ali " "Sanai"
"Ambodiya " "Khatkhari"
"Amroul " "Kalora"
"Andawa " "Dharnauda"
"Ankhwari " "Kherkhedi"
"Arniyagoad " "Geruari"
"Arusi " "Kumbhraj rural"
"Attar " "aron"
"Babri " "Sigora new"
"Badagau " " barsat new"
"badgoan " "Madagan mafi"
"Badgore " "Tijarpur"
"Badgyar " "Pachawali"
"Badjher " "Patulkhi"
Comment