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


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

Re: st: Nearstat competitor count


From   Edward Watkinson <e.g.watkinson@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Nearstat competitor count
Date   Mon, 22 Apr 2013 14:42:26 +0100

Thank you Dimitriy, geonear helped me to get what I needed.

Just to record my method, I used geonear in wide mode to compute the 100 or so nearest 'neighbours' (branches or head offices of al firms) of each head office, after making a unique id for all of the head and branch offices. I then used this id to merge the data with the company ids. It was then a simple case of disregarding where the company ids were identical, then disregarding those which where further away than the distance of interest, and then finally summing the remaining neighbours for each head office to obtain a single variable.

Thanks again,
Edward

On 19 Apr 2013, at 23:30, Dimitriy V. Masterov <dvmaster@gmail.com> wrote:

> Try using geonear from ssc. You will have to drop own offices and then
> collapse to get the totals.
> 
> DM
> 
> On Fri, Apr 19, 2013 at 2:51 AM, Edward Watkinson
> <e.g.watkinson@gmail.com> wrote:
>> Dear Statalist,
>> 
>> Please help. I have a list of latitude and longitude co-ordinates (the head offices of company) and I want to find the number of head offices and branches of OTHER companies within 1km around  each. I have been using the netstat module but I cant think of a way of excluding a companies own branches when doing the counting.
>> 
>> The datastructure is as follows at the moment, the first dataset ha a Unique CompanyId (Head offices) but the second has multiple CompanyIds, one for each branch.
>> 
>> CompanyId_____lat_____long        CompanyId____HeadAndBranchLat___HeadAndBranchLong
>> 
>> 
>> Thanks in advance,
>> Edward
>> *
>> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index