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
Looping through multiple strings for comparisonDear all, I would like to compare educational institutions of two workers and code a binary variabl…
Analysis of rotating panel design data in StataHello everyone, I have a 9-year rotating panel design in which every year, one-ninth of the sample i…
Missing deciles with Portfolio SortHi, I have the following problem. When using the fastxtile command to sort my values into deciles, …
zero-inflated (poisson) mediatorsHi, I am running a mediation which the mediator is zero-inflated poisson and the outcome variable is…
egen newvar=group(varlist) does not generate a variable based on all unique combinations in the varlistI have been using egen newvar=group(varname1 varname2) for a while, with the understanding that newv…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a single variables for multiple values
Post a Comment