Dear all,
I have a dataset comprising thousands of individuals. For each individual I have, among others, region of residence (there are 9 overall) and marital status.
I am required to create a dummy for each region and each should be called like the corresponding region. I have tried the following code:
dummies region
rename region1 Pacific
rename region2 East_South
rename region3 West_South
rename region4 Mountain
rename region5 New_England
rename region6 South_Atlantic
rename region7 West_North
rename region8 East_North
rename region9 Middle_Atlantic
However, I was looking for a more compact way to do this, given that I must create a new variable including all the regional dummies as well as marital status.
Thank you in advance,
Best regards,
AC
Related Posts with Creating dummy variables with category names
Update-all: r(691) I/O errorWhen I started STATA today, the program said that new update is available. So I let STATA download u…
optimize: set skewness to zeroDear Statalisters, I wish to write a simple optimisation problem to find the optimal fractional pow…
An Error marginHi there, This seems simple and basic statistics but I could not get my head around it. Can someon…
how to calculate variance of a variable in a panel data structureHello dear Stata users, I have a panel dataset of household weekly income at regional level (10 regi…
asdoc: Cutomizing the regression output | MS Word from Stata | Confidence Interval, adding stars, etc.I received several emails and comments on blog posts suggesting the addition of confidence intervals…
Subscribe to:
Post Comments (Atom)
0 Response to Creating dummy variables with category names
Post a Comment