I have interviewed heads of households and asked their fathers' names. In some cases the father is alive and has also been interviewed. In some cases he is not. I need to identify whether the father of a certain interviewee has also been interviewed.
I would need something like:
gen Father_Interviewed=find("Father") into name
For instance: find("Metlick Elly") into name.
I know that I could use the command strpos to identify whether a specific string is included in a string variable:
gen Father_MetlickElly_Interviewed = strpos(name,"Metlick Elly")
But I need a function that inputs the father's name automatically.
Thank you very much!
(Incidentally, in the above use of strpos, for some unexplicable reasons the new var is generated only for some names of the new variables but not others).
gianluca
+------------------------------------+
| name Father |
|------------------------------------|
14. | Kepas Metlick Metlick Elly |
36. | Daniel Raoh SAM JARAH |
40. | Metlick Elly Old Elly |
67. | Torohin Pilus THOMAS HAMUN BAREA |
72. | Joseph Raoh Daniel Raoh |
|------------------------------------|
73. | Philimon Hona Daniel Raoh |
74. | Wilfred Hotei Daniel Raoh |
75. | Biloli Raoh Daniel Raoh |
76. | Goldie Ragu Daniel Raoh |
92. | Simon Torohin Torohin Pilus |
+------------------------------------+
.
Related Posts with Searching for variable string content into another string variable
Contingent valuation methodI am using CVM to estimate mean WTP for a conservation program. WTP is elicited in both cash value a…
changing numbers that surround decimalsI have 18,000 observations in a variable, which I have cleaned down to 60 left to address. They are …
Cox regressions for Twitter data (proportional hazards)Dear all, first and foremost a happy new year to all of you! In my current research project, I am …
matching husband-wife and father-daughter observations and generating new variablesDear Statlisters I am working on household survey data. Here I have variables on responses by house…
Computing Average/Mean ROC Curve and AUC among different observersDear all, I was wondering if it would be possible to compute a mean ROC curve, with corresponding m…
Subscribe to:
Post Comments (Atom)
0 Response to Searching for variable string content into another string variable
Post a Comment