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: formatting latitude and longitude variables with sphdist


From   "Tomeka Davis" <[email protected]>
To   <[email protected]>
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:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


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