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
Epimodels package for Stata has been updated at SSCThanks to Kit Baum the epimodels package for Stata has been updated at SSC. Epimodels (written by S…
Gen. new variables based on values for multiple existing variables, TSCS dataDear members, I have put together a data-set with information about military alliances btw states i…
Drop observations based on value of previous observationHi all, I have a panel dataset on productivity. The variables are as follows: activity = the activi…
Counts for multiple variablesHello, I am analyzing a hospital dataset which provides demographic, diagnostic, and procedural data…
Panel-Data Logistic regression Probability of LR Test is 1Dear Statalist, I have a question concerning the a logistic regression with panel data. I have a pa…
Subscribe to:
Post Comments (Atom)
0 Response to Creating dummy variables with category names
Post a Comment