Dear all,
I am a Stata newbie and would appreciate your help with the following problem. I have a dataset with variables pid (=unique number of an individual), parid (= pid of individual's partner), sex (= sex of individual with pid). With these I would like to generate output for a new variable parsex capturing sex of each parid. The idea is to find parid in the pid column and show sex = parsex.
I have tried the following code:
gen parsex = .
replace parsex = sex if pid == par
I am a Stata newbie and would appreciate your help with the following problem. I have a dataset with variables pid (=unique number of an individual), parid (= pid of individual's partner), sex (= sex of individual with pid). With these I would like to generate output for a new variable parsex capturing sex of each parid. The idea is to find parid in the pid column and show sex = parsex.
I have tried the following code:
gen parsex = .
replace parsex = sex if pid == par
Comment