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]

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


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Loop to determine values of a variable based on values of variables
Date   Sat, 17 Aug 2013 17:42:17 +0100

See the FAQ

http://www.stata.com/support/faqs/data-management/neighbors-on-rectangular-grid/

Nick
[email protected]

On 17 August 2013 17:21, Rainer zu Fall
<[email protected]> wrote:

> 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.
*
*   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