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 |
Diogo L Pinheiro <diogo.pinheiro@pubpolicy.gatech.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
st: Creating square matrix with obs counts from 2 non unique id variables |

Date |
Tue, 19 Apr 2011 11:47:34 -0400 |

Hello, everyone,

Observation ID1 ID2 1. 10 12 2. 10 11 3. 11 12 4. 11 10

From that, I want to create a square matrix that would look something like: 10 11 12 10 0 1 1 11 1 0 1 12 0 0 0 So that I could have all the counts of each combination of organizations.

tab ID2, gen(newID) collapse (sum) newID, by(ID1)

Thanks! * * 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/

**Follow-Ups**:**Re: st: Creating square matrix with obs counts from 2 non unique id variables***From:*Nick Cox <njcoxstata@gmail.com>

- Prev by Date:
**st: khb command** - Next by Date:
**Re: st: Bootstrap not reporting observed coefficient as the mean of expression** - Previous by thread:
**st: khb command** - Next by thread:
**Re: st: Creating square matrix with obs counts from 2 non unique id variables** - Index(es):