In a dataset in the form of:
addressnr hhid general_health
1 1 5
2 1 6
3 2 9
4 2 8
5 3 2
6 3 4
With every hhid containing a couple
I would like to create a new variable containing the health of one's partner resulting in the following
addressnr hhid general_health partner's health
1 1 5 6
2 1 6 5
3 2 9 8
4 2 8 9
5 3 2 4
6 3 4 2
I have already gotten very close to what I want using rangestat:
rangestat (min) general_health_partner= general_health, interval(adressnr 1 2) by hhid
However this only generates the value for one of the two household members
Thanks in advance for the resonses!
Related Posts with Creating a variable for partner's health score
Aggregating several variables with some missing observationsHello Statalisters, I am creating an index with several made up of several indicators and some of t…
Create a variable measuring change of score from one wave to anotherThere are three waves of data in the survey I use. My independent variable (a score) is continuous a…
Exporting a table to LatexHi everyone, I have the following code: table prov immig sex if inlist(immig,1,2) and I am trying …
graph bar problem.Dear All, i have this data set. Code: * Example generated by -dataex-. For more info, type help dat…
Reversing scale for variables like life expectancy, enrollment ratesHello wonderful Stata helpers, I know this is less Stata-specific and more conceptual, but I would a…
Subscribe to:
Post Comments (Atom)
0 Response to Creating a variable for partner's health score
Post a Comment