My goal is to obtain the gender ratio of weekly housework hours by dividing the man's hours of housework with the partner's ones.
There is a variable called v31 that is equal to 1 when the individual is the principal member of the family (the woman) and equal to 2 when the individual is the husband. I also have a variable containing the household ID (v4) and another variable that tells me the progressive number of the family within the household (v32), which is equal to 1 if it is the first family of the household, 2 if it is the second... .
An example of the code:
Code:
clear input obs v4 v32 v31 v850 1 1 1 1 27 2 1 1 2 12 3 2 1 2 8 4 2 1 1 41 5 3 1 2 0 6 4 1 1 29 7 4 1 2 11 8 4 2 1 37 9 4 2 2 1 end list
The issue is that I do not know how to tell stata to do the ratio so that each husband's housework hours are divided by his partner's ones.
I have tried using the command:
Code:
bysort v4 v32 v16: gen domwork_ratio = cond(v4 != v4[_n-1],999999,v850_tot[_n-1]/v850_tot)
Any help would be much appreciated,
Vincenzo
0 Response to Lagged Variable generation
Post a Comment