Hey,
I Hope someone can help me with this:
I have a dataset of households in various zip codes. I want to generate a variable that places the hholds into five different categories according to an area index of multiple deprivation using the zip codes that were correspondingly identified.
The logical way to do this in stata is to write a command that looks like this:
gen if aimd5=="12345" | zip=="82456" | zip=="56234" | zip==..............
replace if aimd5=="75687" | zip=="45688" | zip=="95689" | zip==..............
replace if aimd5=="14687" | zip=="34687" | zip=="64687" | zip==..............
replace if aimd5=="54687" | zip=="54645" | zip=="54687" | zip==..............
replace if aimd5=="64687" | zip=="78987" | zip=="21387" | zip==..............
There would be about 8000 "or" conditions The problem is, Stata doesn't allow this many "OR" conditions in that statement.
This command works fine if I only put in 10 zips or so.
Is there any way for me to perform this operation?
Kind regards
Related Posts with Generating a new variable conditional on multiple values - using 'or' command?
Help interpreting resultsHi, I am very new to STATA and econometrics and I need some help interpreting my results. I wish to …
similarity ratio matrix Hi all, I have 150 forums and proportion of participants who said they were interested in 7 differ…
spectral normalization matrixHi all, I've made a matrix based on the similarity of organizations in forums (Euclidean distance):…
Error in forestplot: option lalign() not allowedHello, on running the "metan" command, metan OR ORlci ORuci, label(namevar=id) wgt(bweight) first(0.…
three-dimensional fixed effects and summing variable by 4 groupsHi all, I am a master student and I am trying to estimate effect of sanctions on import. Database c…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable conditional on multiple values - using 'or' command?
Post a Comment