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: calculate pairwise distance between tracts
From
Austin Nichols <[email protected]>
To
[email protected]
Subject
Re: st: calculate pairwise distance between tracts
Date
Thu, 4 Nov 2010 17:34:26 -0400
sara borelli <[email protected]> :
If you really want to cross the data, see -help cross-, but that may
produce a really large dataset.
You should consider looping over observations and computing the
distance of each tract from tract i within the loop, computing what
you need and saving only the relevant info. See also e.g.
http://www.stata.com/statalist/archive/2009-07/msg00257.html
FYI, -vincenty- is on SSC.
On Thu, Nov 4, 2010 at 5:21 PM, sara borelli <[email protected]> wrote:
> Dear statalister
> I am trying to calcluate pariwise distance between census tracts whithin state. I have longitude and latitude for each tract and I know vincenty command calculate distance
> However, I am having sme troubles to organize data in the appropriate way to apply the command
>
> suppose I have
> tract
> 1
> 2
> 3
>
> if I put the data in the form
>
> tract_orgin tract_Dest long_orig long_dest lat_orig lat_dest
> 1 1
> 1 2
> 1 3
> 2 1
> 2 2
> 2 3
> 3 1
> 3 2
> 3 3
>
> if I organize the data in this way I can apply
> vincety (lat_orig long_orig lat_dest long_dest) whihc gives me distance between any 2 tracts
>
> the problem is that I am having hard time to organize the data in that format given the large number of census tracts
>
> any suggestion on how to do this efficiently?
> thanks
>
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/