Dear Stata users, I have the following data sample where fam_id represents the family, hh_count represents the number of family members within a family. Mother, father, and person_id are the string variables that identify the person and other family members. In the last column, I find the location of the mother of the corresponding family member.
clear
input byte fam_id str1(mother father person_id) byte(hh_count place_mother)
1 "" "" "x" 1 .
1 "x" "y" "d" 2 1
1 "x" "y" "e" 3 1
1 "x" "y" "f" 4 1
1 "z" "b" "y" 5 6
1 "a" "c" "z" 6 .
end
For example, the person e's mother is x and located at the 1st column of person_id.
I want to create a new variable that identifies the mother. What I require is something like this:
input byte fam_id str1(mother father person_id) byte(hh_count place_mother) float mother_find
1 "" "" "x" 1 . 1
1 "x" "y" "d" 2 1 .
1 "x" "y" "e" 3 1 .
1 "x" "y" "f" 4 1 .
1 "z" "b" "y" 5 6 .
1 "a" "c" "z" 6 . 2
end
Could you please help me with that?
Regards,
Related Posts with Identify the variable based on a given location
Convergence fracreg logitI am trying to model the rate of occupational injuries as a function of a series of independent vari…
Matching sample based on multiple variablesHi, I have two samples. Sample 1 (main sample) includes 200 companies from Sweden. Sample 2 includes…
Doubt when exporting string with quotes to .txtHey all, Please consider the following scenario: Code: clear set obs 2 gen id_genbank = ">Seq…
Generate variable that takes the name of one of a list of dummy variablesDear statalist, I am trying to solve the following problem: I have 105 dummy variables for 105 mon…
Cross-equation test in Panel AnalysisHI, I'm trying to compare coefficient from different regression models with panel data. In a normal …
Subscribe to:
Post Comments (Atom)
0 Response to Identify the variable based on a given location
Post a Comment