Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
"Tomeka Davis" <soctmd@langate.gsu.edu> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: SPHDIST, creating pairs |

Date |
Thu, 25 Feb 2010 16:26:54 -0500 |

Hello - I am trying to calculate distance between two points using longitude and latitude data. I have come across 2 different Stata commands to do this - SPHDIST and VICENTY. I have not been able to install the VICENTY command. It appears from previous StataList posts that there might be problems associated with it and therefore it is temporarily unavailable (right?). Although I have longitude and latitude data, I am not sure how to create the pairs necessary to calculate distance with SPHDIST. I would like to calculate distance from a each public school in a district to all the other private schools in the same district. My data SHOULD look like this: District ID Public School ID Private School ID Public Longitude Public Latitude Private Latitude Private Longitude 1 A 1 1 A 2 1 B 1 1 B 2 1 B 3 1 B 4 2 C 1 2 C 2 2 C 3 2 D 1 2 D 2 I initially had two separate files; one with public school data and one with private school data. I appended the public school file and tacked on the private school data. NOW the data looks something like this Distric ID School ID Public School Private School Latitude Longitude 1 A Y N 1 A Y N 1 B Y N 1 B Y N 1 B Y N 1 B Y N 2 C N Y 2 C N Y 2 C N Y 2 D N Y 2 D N Y But I want to pair each public school with each private school. So far, I have figured out how to produce a data set pairing ALL schools within each district; this would pair public schools within a district with other public schools in the same district (using a an FAQ page from 2005 written by Nick Cox titled "Expanding datasets to all possible pairs"). However, I don't want this. I only want to pair each public school with each private school in the same district. How do I accomplish this? I would appreciate any help anyone could offer. Also, any suggestions about the best distance command would be appreciated. Thank you. * * 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/

**Follow-Ups**:**Re: st: SPHDIST, creating pairs***From:*TA Stat <tastat@gmail.com>

**st: RE: SPHDIST, creating pairs***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: SPHDIST, creating pairs***From:*Austin Nichols <austinnichols@gmail.com>

- Prev by Date:
**Re: Re: st: RE: regression r(103): too many variables** - Next by Date:
**Re: st: SPHDIST, creating pairs** - Previous by thread:
**st: Urgent-Help** - Next by thread:
**Re: st: SPHDIST, creating pairs** - Index(es):