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
log dependent variable and % independent variableHello Statalisters, I probably have an easy to answer question. However, I couldn't find the answer…
Capturing the Return Code from an External ProgramI have an ado file that calls an external binary executable. Is there any way to capture the return …
Keep only matching valuesI have a dataset that lists all products sold in a one year period in two stores. The quantity sold …
Comparing coefficients across DRsI run doubly robust regressions after running PSMatch2 on two different samples. I would like to com…
How to rename multiple variablesHi, I tried to rename many variables in the following way, but it doesn't seem to work. Code: renam…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a single variables for multiple values
Post a Comment