Hello,
i am trying to divide the 50 states into 2 categories: "childcare" and "no childcare".
I am assigning a value of 1 for "childcare" and 2 for "no childcare". Only 4 of the states are "childcare" and the rest are "no childcare." I already generated the variable "childcare" with this line of code:
gen childcare=.
replace childcare=1 if state==1 & state==43 & state == 27 & state == 21
for "no childcare," which is the remaining 46 states, is there an easier way to generate a variable without coding every state by hand?
Related Posts with Generating a single variables for multiple values
tempname frames questionCan someone explain why posting to a temporary frame doesn't work in the code below whereas posting …
r(459);unconditional standard errors derived assuming full estimation sample; indepvars dropped observations from the estimation sampleHi, I am estimating (using Stata 15) an eprobit model with an endogenous treatment, for which I had…
Ivreg2 giving negative centred r2 values and very large confidence intervalsHello Statalist I am very inexperienced with stata and I am currently trying to test a hypothesis u…
merging panel datadear, I have 2 panel datasets which I want to merge. One dataset contains values from 2009 to 2015 …
What is the difference between Moran I and Pesaran and free's cross sectional dependence tests?Dear readers, I have a question about spatial econometrics: I run a Moran I test on my residuals fro…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a single variables for multiple values
Post a Comment