I am using a data set of 50 countries which are separated into four regions.
I want to create a variable of regional contagion, where recgontagion for country j takes one if and only if there is a crisis in at least one country other than country j and this country is in the same region as country j.

I have been the below command but it doesn't work:

replace regcontagion=1 if (evnt3w==1&country!=country &region_id==region_id)