Bookmark and Share

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, is already up and running.

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

st: formatting latitude and longitude variables with sphdist

From   "Tomeka Davis" <>
To   <>
Subject   st: formatting latitude and longitude variables with sphdist
Date   Fri, 02 Apr 2010 11:33:51 -0400

Hello Stata users-

I am having trouble creating a distance measure using -sphdist- and I
am pretty sure it is linked to the way my latitude and longitude
variables are formatted.  I am using secondary data, and these variables
are coded so that the decimal is implied. It is also a string variable
in the original data set.  For example, if a school’s latitude is 30
degrees, 30 minutes north  it is shown as 030500000.

I used the -destring- command to convert the latitude and longitude
variables to numeric.  Then I multiplied the new numeric variable by
.000001 so that the decimal would be in the proper place.  This is
clearly not the proper way to go about this, because my resulting
distance measures are off quite a bit.  I get a distance of thousands of
miles between two points that are within the same county.

My question is:  How should the latitude and longitude measures be
formatted?  What is the best way to go about converting these variables
into the standard degree decimal notation.

Thank you very much.
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index