Dear all,
I am using Stata 16, on mac. I want to create a region variable based on my dummy variables west, ne, midwest, and south, but I am not sure how to do so. south is my reference category. I included the commands I used to construct my dummy variables along with a snapshot of my dataset.
generate west = 0
replace west =1 if 2.state | 3.state | 5.state | 6.state | 12.state | 13.state | 27.state | 29.state | 32.state | 38.state | 45.state | 48.state | 51.state
generate ne = 0
replace ne =1 if 7.state | 20.state | 30.state | 22.state | 31.state | 33.state | 39.state | 40.state | 46.state
generate midwest = 0
replace midwest =1 if 14.state | 15.state | 16.state | 17.state | 23.state | 24.state | 26.state | 28.state | 35.state | 36.state | 42.state | 50.state
generate south = 0
replace south =1 if 1.state | 4.state | 8.state | 10.state | 11.state | 18.state | 19.state |21.state | 25.state | 37.state | 34.state | 41.state | 43.state | 44.state | 47.state | 49.state | 48.state | 9.state
Array Array
Thank you in advance for your help
Jason Browen
Related Posts with Help generating region variable
Gravity estimation including fixed effectsHi everyone, I am estimating a gravity model of trade including exporter-time and importer-time fix…
What does "log using 'filename', replace" do? To create logs or to replace the existing ones?Dumb question, but in my professor's notes it's to "create log in current folder." But isn't it foll…
Binary Endogenous variable in Negative binomial regressionHello everybody, In my research, the dependent variable (DV) is count data and endogenous variable …
Merging multiple panel data filesHello all, I have individual panel data and two state-level panels I seek to merge together. I have…
What are some Stata skills that you need to do RA for professors? And what are the good sources to learn data cleaning?I'm about to work as a RA for a professor, what would I be expected to do? I have heard that data cl…
Subscribe to:
Post Comments (Atom)
0 Response to Help generating region variable
Post a Comment