Check out the FAQ at 
How do I produce a dataset based on all possible 
pairs of identifiers within each group? 
http://www.stata.com/support/faqs/data/pairs.html
Nick 
[email protected] 
Sen Kunal Dr
 
> This may seem like a simple question, but I am a beginner in STATA:
> 
> I have observations on individuals for various cities. I would like to
> transform my data such that I generate pairs from all 
> possible combinations
> of individuals for each city. So if there are 4 individuals 
> for a particular
> city, I have 6 pairs (AB, but ruling out BA). How do I do this?
> 
> Then I would like to generate a dummy which takes the value 
> one if the pair
> satisfies a particular condition (both individuals have 
> arrived in the city
> from a particular region outside the city), zero otherwise. 
> How can I do this?
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/