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?
HLM Models and Cluster Variable SelectionI am involved in a research project examining HIV risk behaviors, pooling data from recent surveys i…
error in panel dataHi, i am trying to set a panel data. I have a list of M&A deals during 2010-2010 and i want to a…
IGM userwritten programDear friends, I am trying on the stata command, igmobil with upward mobile index using a written pro…
Counting Outliers using standard deviationsHi, I have a variable Y, is there any stata function that can help me to count and identify the outl…
Hausman test problemHi, I am doing a Hausman test and run 2 regressions, with re and fe. But for some reason i can do i…
Subscribe to:
Post Comments (Atom)
0 Response to Generating a new variable conditional on multiple values - using 'or' command?
Post a Comment