I have three variables gender sector and wf. Gender and sector are categorical variables, where gender takes values between male and female & sector takes a value between rural and urban. wf is a binary variable which takes the value 1 if the individual is in the workforce and zero otherwise. I want to create four new variables rural_male_wf, rural_female_wf, urban_male_wf and urban_female_wf that take value from variable wf if an individual is from the rural sector and male and so on. Can someone please help me regarding the same?
clear
input str5(sector gender) float(wf rural_male_wf rural_female_wf urban_male_wf urban_female_wf)
"rural" "male" 0 0 . . .
"rural" "femal" 1 . 1 . .
"urban" "male" 1 . . 1 .
"rural" "male" 1 1 . . .
"urban" "femal" 0 . . . 0
"urban" "femal" 0 . . . 0
"rural" "femal" 1 . 1 . .
"rural" "male" 0 0 . . .
"urban" "femal" 1 . . . 1
"urban" "male" 0 . . 0 .
"urban" "male" 1 . . 1 .
"rural" "femal" 0 . 0 . .
"rural" "male" 1 1 . . .
"urban" "male" 0 . . 0 .
end
Related Posts with Create new variables using two categorical variables
Separate regression for each group in Panel dataHi, I have a panel dataset, which includes observation for returns and turnover for the past 52 wee…
long format delete same observatiosn per idHi, I have a long dataset and I want to tab and analyse outcomes by sex, pmqreg and age. At the min…
stata package for case cross over studiesis there a way to organize/manipulate data for use in a case crossover study? …
HELP URGENTLY NEEDED: Occurrence of an event for the second time (Panel data)Dear Statalisters, I intend to analyse panel data (long format) on the effects of individuals taki…
VAR, test for normality, autocorrelation and heteroskedasticity- should I use stationary first differences for these tests? Please help!HI, I am checking thhe long-term relationship between unemployment and labor force participation rat…
Subscribe to:
Post Comments (Atom)
0 Response to Create new variables using two categorical variables
Post a Comment