Hi Statalists,
I have a problem that doesn't seem to be quite the same as all the other examples that I can find around it. I hope that someone can help.
I have a dataset:
id wave age partnerid
001 1 50 002
001 2 51 002
001 3 52 002
002 1 36 001
002 2 37 001
002 3 38 001
003 2 19 .
003 3 20 005
003 4 21 005
004 2 70 .
005 3 18 003
005 4 19 003
I need to create a new variable "age_partner" which records the age of the partner in each line.
For example:
id wave age partnerid age_partner
001 1 50 002 36
001 2 51 002 37
001 3 52 002 38
I want to be able to repeat this for several variables including gender and income.
If anyone can help, I will be very grateful.
Many thanks in advance.
Grace
Related Posts with Generate new variable using a partner id
Ms-varHi there, I currently use 15.1 version and it seems the interface does not allow for dealing with MS…
Creating this TableHello all, I am doing an Age-Period-Cohort analysis and was wondering how I can create the follow ta…
cmp for a multinomial charity choice/hurdle modelHi, I am trying to estimate a model of charitable giving. I have a study where individuals are given…
Creating dummiesHey everyone! I have panel data between 2014 and 2018 on multiple socioeconomic and demography facto…
How to generate counterfactual polynomial fitHello, I am looking to generate a counterfactual polynomial fit for some data. Essentially, I have …
Subscribe to:
Post Comments (Atom)
0 Response to Generate new variable using a partner id
Post a Comment