Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Loop to determine values of a variable based on values of variables


From   Rainer zu Fall <[email protected]>
To   [email protected]
Subject   st: Loop to determine values of a variable based on values of variables
Date   Sat, 17 Aug 2013 18:21:13 +0200

The observations in my data are grid-years. A grid is a roughly
quadratic spatial unit. I have a variable denoting whether or not a
conflict is going on in a grid. However, I want to know whether
conflicts are going on in nearby grids, too.

I can identify nearby grids by their values on the variables "row" and
"column"- any grid with values deviating from the values of my grid of
interest no more than one unit on both variables are adjacent.

My aim would be to create a dummy variable adjacentconflict=1 if
conflict==1 in any of the adjacent grids.
I reckon I have to write a loop to do this. I have tried around a bit,
but seem to be at a loss.
Thank you in advance.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index