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]

RE: st: RE: RE: Identify country from a latitude longitude base


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   RE: st: RE: RE: Identify country from a latitude longitude base
Date   Mon, 9 Sep 2013 14:58:39 +0000

I don't think I would bother with -regexm()-, given that the returned address may come in a variety of formats.  Perhaps some combination of reverse(), strops(), and substr():

. gen country=substr(r_addr,-strpos(reverse(r_addr),",")+2,.)


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Mauricio Andrés Vela
Sent: Monday, September 09, 2013 10:32 AM
To: [email protected]
Subject: Re: st: RE: RE: Identify country from a latitude longitude base

Thank you, that was exactly what I was needing. Now I have a problem of how to use regexm to extract from the string variable the country.
For example from "Unnamed Road, Mayflower, AR 72106, USA" let only USA

2013/9/9 Joe Canner <[email protected]>:
> The documentation for -geocode3- is a little confusing for this so here is an example:
>
> . geocode3, coord(varname)
>
> Where -varname- is a string variable containing the latitude and longitude separated by a comma, e.g. "47.99,16.93"
>
> The program will create a new variable which is the complete address.  The country name will be the last item in the address.
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Joe Canner
> Sent: Monday, September 09, 2013 9:23 AM
> To: [email protected]
> Subject: st: RE: Identify country from a latitude longitude base
>
> Try -geocode3- available from SSC.
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Mauricio 
> Andrés Vela
> Sent: Monday, September 09, 2013 8:53 AM
> To: [email protected]
> Subject: st: Identify country from a latitude longitude base
>
> I have a data with the latitude and longitude location of some events around the world but it don't have any variable that identify which country correspond to that latitude and longitude. Is there any command or how could I identify the country from the latitude and longitude information?
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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