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: RE: Calculate Distance between Properties within Portfolios


From   Joe Canner <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: RE: Calculate Distance between Properties within Portfolios
Date   Wed, 11 Sep 2013 01:49:49 +0000

McKay,

Take a look at -joinby-. You will probably have to create a duplicate copy of your dataset and rename the property_id, lat, and lon variables in the duplicated data set. Then do:

. use original.dta
. joinby portfolio_id using duplicate.dta
. geodist lat lon duplat duplon

(Warning: this will create about 6.5 million records.)

Regards,
Joe
________________________________________
From: [email protected] [[email protected]] on behalf of S. McKay Price [[email protected]]
Sent: Tuesday, September 10, 2013 6:28 PM
To: [email protected]
Subject: st: Calculate Distance between Properties within Portfolios

Hello,

I'm trying to calculate the distance, in miles or kilometers, between
all possible pairwise combinations of properties within a given
portfolio.  Is there an efficient way to structure the data to
accomplish this?

My data include numerous portfolios (roughly 200), each with a unique
portfolio identifier (portfolio_id).  And, there are multiple properties
within each portfolio (180 on average), where each property has a unique
property identifier (property_id).   I have latitude and longitude
coordinates in decimal form for each property (e.g. 42.270873
-83.726329) for use in a command such as -geodist- from SSC, or
something similar.  The data are organized as follows:

portfolio_id property_id latitude longitude
1 1 lat lon
1 2 lat lon
1 3 lat lon
...
2 1 lat lon
2 2 lat lon
2 3 lat lon
etc...

Any suggestions?  Thank you for your consideration.

McKay

*
*   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