I have a variable for U.S. states that includes 01, 02, 03, ... , 50, 51, and these are all strings representing the 50 U.S. states and the District of Columbia. I would like to regress a dependent variable on each state individually as a dummy binary variable, but I don't want to have to create 51 separate dummies.
Is there a quick way to do this? I'm aware of using "i" to create separate dummies (e.g. "reg depvar i.indepvar"), but this doesn't seem to work since the "states" variable contains strings.
Any help is appreciated.
Related Posts with Convert Single String Variable to Many Binary Variables
nl with inequality constraints lead to bad local optima, with fixStataCorp has a helpful FAQ, How do I fit a linear regression with interval (inequality) constraints…
nl with inequality constraints lead to bad local optima, with fixStataCorp has a helpful FAQ, How do I fit a linear regression with interval (inequality) constraints…
Transpose regression table, adding S.E. and P valueHello There, I am currently trying to transpose my regression results (i.e having one model in a ro…
Thresholds displayed on ROC CurveI'm graphing a binary variable on a 7-category variable, and I'd like the 7 categories to be labeled…
Global macro for a directory using project fileThe following commands are fickle, not reliable, working sometimes and not at others. I use a projec…
Subscribe to:
Post Comments (Atom)
0 Response to Convert Single String Variable to Many Binary Variables
Post a Comment