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: formatting latitude and longitude variables with sphdist
From
"Tomeka Davis" <[email protected]>
To
<[email protected]>
Subject
re: st: formatting latitude and longitude variables with sphdist
Date
Fri, 02 Apr 2010 13:47:18 -0400
Thank you very much. I was under the mistakened impression that the deg1nth min1nth portion of the command were options.
>>> Kit Baum <[email protected]> 4/2/2010 11:41 AM >>>
<>
Tomeka said, in re Bill Rising's sphdist from SSC,
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.
First of all this is not a matter of formatting. In Stataspeak, formatting refers only to what the data look like when you print them out. It does not affect their contents. If you take 030500000 and convert it to numeric values, you need to create two variables, per help sphdist: lat1 = 30, lat2 = 30. So extract the first three bytes and call their numeric equivalent lat1, and extract the next two bytes and multiply by 0.60 to get them in minutes. Call that variable lat2. If you want more precision, pull off more of the 5000000 piece, but it must be converted to minutes (or minutes and seconds). Do the same for longitude, as sphdist requires (at least) two lat variables and two lon variables.
Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html
An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html
An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html
*
* 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/
*
* 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/