Hello,
I’m working with a time use database with information at the individual and household level. I have a couple of variables about who in the household the individual is doing domestic work for. For example, there is a question “Do you cook for someone in the household” if the individual responds affirmative, then they have to report the order of the member of the household they cook for. I want to create an indicator that takes the value of 1 if the person being cooked is younger than 6 and the value of 2 if its older than 65. I'm not sure how to loop through the observations in this case.
The data I have looks like this:
idhogar order age cookfor ord_cookfor
1 4 1 0 .
1 3 7 0 .
1 2 57 0 .
1 1 42 1 4
2 5 67 0 .
3 7 48 0 .
3 6 57 0 .
3 8 21 0 .
4 11 65 1 9
4 10 67 0 .
4 9 30 0 .
5 14 59 0 .
Thank you,
Tessa
Related Posts with How to create variables recording characteristics of the other members in the household
Ignoring multiple characters while using destringIf I want to have Stata ignore all letters that come after L while using destring, is there a way to…
Help with mergingHello, I have been working with a data set that uses NHANES data from 2003-2012. I wanted to add dat…
Splitting messy string varsHello, I am hoping to split up these string vars and generate binary new vars based on whether they …
MaxDiff (Best-Worst ranking) Analysis in StataHi all, long time lurker here deciding to seek direct support from the experts here as I didn't find…
Problems with a loop to generate new variablesHello Stata Community. I'm working in my master thesis with a data base about middle class, their v…
Subscribe to:
Post Comments (Atom)
0 Response to How to create variables recording characteristics of the other members in the household
Post a Comment