Hi all--Is it possible to have multiple conditions using an if statement?
I'm trying to create several variables and sum all but two of them.
Here's my code:
foreach e in aborig afr asia can camer carber euro namer nonabor ocean samer{
gen `e'_grt=pob_`e'+poc_`e'
if "`e'"!="aborig" | "`e'"!="nonabor" replace sum_grt=sum_grt+`e'_grt
}
It executes, but does not perform the second part of the if command beyond the "or" operator ("`e'"!="nonabor"). It sums all the variables except the "aborig" one, but I need it to sum all the variables except both "aborig" and "nonabor". Am I doing something illegal here?
Thanks,
Mike
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/