My problem is that I want to create dummy variables for different brackets of my wage variable, say, I want to create a dummy for wages less than 10 £, a dummy for wages between 11 and 20 , a dummy for wages between 21 and 30, .. and so on up to wages equal to say 5000. Since this is a large number of dummies that I need to generate.
I looked for the following thinking my problem is the same, https://www.stata.com/statalist/arch.../msg00362.html here in this I tried Nick Cox solution thinking that I can extend it to any number of required dummies. However, when I extended it for up to 4 it gave me invalid syntax. I tried the following:
Code:
bysort district: gen dummy = cond(inrange(fwage,0,10), 0, cond(inrange(fwage,11,20), 1,cond(inrange(fwage,21,30), 2, cond(inrange(fwage,31,40), 3, cond(inrange(fwage,41,50), 4 ))))) if (seq01==1|seq02==1|seq03==1|seq04==1|seq11==1|seq15==1)
Another thing I want to do apart from creating these dummies is that I want employment count in each of the bins above mentioned. For example how many people are working in the first bin ( whose wage is between 0 and 10), in the 2nd bin ( between 11 and 20) and so on...
Can someone guide in this respect?
Thanking you all in anticipation.
Zahid
0 Response to create dummy variables for every certain range of values of another variable
Post a Comment