Hey there
I am using cross-sectional for South Africa that that includes household(hhid) and individual level(pid) data
I have some employment data ( adult individual level) that I want to use to generate a dummy variable for the entire household if no one in the household is unemployed? So the value would then be 1 for all the household members if someone in the household is employed and 0 if no one in the household is employed.
My individual employment variable is however categorical (0=unemployed; 1=employed; 2=Not economic active) Yet I still just want to get an individual-level variable that equals 1 if you are part of a household with someone in the labour market and 0= if you are part of a household without any household member in the labour market
Below please find an example of my data (Sorted by hhid)
hhid pid labourmarket
500000 636991 1
500000 640576 0
500001 405734 2
500002 305961 1
500002 731651 2
500002 401746 .
500002 630858 .
500003 769557 1
500003 782520 .
500003 763879 .
500003 746176 2
500003 787751 2
500003 303668 2
500003 703450 0
500004 310664 1
500005 319004 1
500006 795652 0
500006 755010 2
500006 630051 .
500006 716968 1
500006 624989 .
500006 734074 2
500006 401698 0
500007 753507 .
500007 747659 .
500007 316119 0
500007 796156 2
500008 408602 2
500008 735370 0
Kind regards
Frederich
Related Posts with Generating a dummy variable for an entire household based on a individual labour market characteristic
Error with rename using local macrosI importing many excel files with long variables names and lots of space. The truncated variable nam…
Additive interaction with conditional logistic regressionDear Statalist, I am analyzing data from a case-control study using conditional logistic regression…
Finding out proportions by groupsHello everyone, I'm struggling with one piece of code and am hoping I can get some help here. I hav…
How to calculate the frequency of one variable occurring in the other?Hello everyone, I want to calculate the percentage of migrants in each district. I tried the codes …
Converting CRSP daily stock return to weekly returnHi all, A Stata newbie here. I am working with the daily stock return data from CRSP. I am required …
Subscribe to:
Post Comments (Atom)
0 Response to Generating a dummy variable for an entire household based on a individual labour market characteristic
Post a Comment