serial | numprec | pernum | fchloc | momloc | firstchild | nchild | nchild2 | age |
1184821 | 18 | 1 | 0 | 9+ | 53 | |||
1184821 | 18 | 2 | 0 | 9+ | 9 | 52 | ||
1184821 | 18 | 3 | 3 | 2 | 1 | 1 child | 9 | 27 |
1184821 | 18 | 4 | 2 | 1 child | 9 | 26 | ||
1184821 | 18 | 5 | 2 | 1 child | 9 | 23 | ||
1184821 | 18 | 6 | 2 | 0 childr | 9 | 21 | ||
1184821 | 18 | 7 | 2 | 1 child | 9 | 19 | ||
1184821 | 18 | 8 | 2 | 0 childr | 9 | 16 | ||
1184821 | 18 | 9 | 2 | 0 childr | 9 | 14 | ||
1184821 | 18 | 10 | 2 | 0 childr | 9 | 12 | ||
1184821 | 18 | 11 | 2 | 0 childr | 9 | 10 | ||
1184821 | 18 | 12 | 0 | 1 child | 27 | |||
1184821 | 18 | 13 | 0 | 1 child | 23 | |||
1184821 | 18 | 14 | 0 | 1 child | 21 | |||
1184821 | 18 | 15 | 15 | 12 | 1 | 0 childr | 1 | 5 |
1184821 | 18 | 16 | 16 | 13 | 1 | 0 childr | 1 | 3 |
1184821 | 18 | 17 | 17 | 14 | 1 | 0 childr | 1 | less tha |
1184821 | 18 | 18 | 18 | 7 | 1 | 0 childr | 1 | less tha |
I've created 3 new variables at an attempt to somehow add firstchildlocation to the mother
Code:
by bysort serial momloc: gen nchild2 = _N if momloc != 0 gen firstchild = 1 if eldch[_n-pernum+momloc] == age & age < 18 gen fchloc = pernum if firstchild == 1
I would like to do, for example, for pernum3
Code:
replace momloc[_n-pernum+momloc] = momloc[_n] if firstchild == 1
I've been searching on google for 'copying (and other similar words) values to different rows on stata'.
Any kind of command or other "search terms" that are more in line with what I'm looking for would be much appreciated.
Comment