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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: How to calculate cross-subgroup values within the same variable? |

Date |
Thu, 7 Jul 2011 15:38:23 +0100 |

This is an FAQ. FAQ . . Creating variables recording prop. of the other members of a group . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox 4/05 How do I create variables summarizing for each individual properties of the other members of a group? http://www.stata.com/support/faqs/data/members.html Nick n.j.cox@durham.ac.uk Yao Amber LI I am trying to calculate a cumulative distance between each local firm and all other foreign firms within the same industry each year. My data structure is as follows (for each year and each industry). Firm_ID ownership latitude longitude 1 local 2 local 3 local 4 local 5 local ... local I local 1 foreign 2 foreign 3 foreign ... foreign J foreign To sum up, in each industry each year, I have a group of local firms with their latitude and longitude; and a group of foreign firms with their latitude and longitude. I need to calculate a cumulative distance between each local firm (i) and all other foreign firms in that industry the same year. The distance formula will be Dist_i = sum_{j} function(d_{ij}), where i=1,..., I; and j=1,..., J. And d_{ij} is a function of latitude_{i}, longitude_{i} and all other FOREIGN firms' latitude and longitude. How should I achieve that object? How can I loop over each local firm with all other foreign firms? Any help would be appreciated. Thanks! All my best, Amber * * 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/

**References**:**st: How to calculate cross-subgroup values within the same variable?***From:*Yao Amber LI <yaoamber@gmail.com>

- Prev by Date:
**st: Re: dropping variables with lots of missing** - Next by Date:
**st: standardized confidence intervals using mlogit** - Previous by thread:
**st: How to calculate cross-subgroup values within the same variable?** - Next by thread:
**st: Re: dropping variables with lots of missing** - Index(es):