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
How to recreate longitudinal analyses from SAS in STATA using xtgee only using SAS output???Hello all, I have been trying to recreate SAS output in Stata but keep getting discrepancies. Unfor…
Analyzing two time points with regressionI am analyzing data with the mental health component score (measured 0-100) for 4500 individuals. Th…
longitudinal population survey dataHello, I have a longitudinal population survey data. This is actually my first time working with su…
mi predict problemDear all, I am having problems trying to get the baseline survivor function after mi predict. I am …
groups command, export/copy table to excelthe groups function is a very useful command, however the output seems to be not very transferable -…
Subscribe to:
Post Comments (Atom)
0 Response to Convert Single String Variable to Many Binary Variables
Post a Comment