Statalist The Stata Listserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: Identifying repeated observations in different panels

From   "Michael Blasnik" <>
To   <>
Subject   st: Re: Identifying repeated observations in different panels
Date   Wed, 18 Jan 2006 09:37:24 -0500

If you want a count of the number of provinces in each code_institution:

bysort code_institution province: gen perprovince=(_n==1)
by code_institution : egen numprovince=sum(perprovince)

You could then:

list province code_instituition if numprovince>1 & perprovince==1

Michael Blasnik

----- Original Message ----- From: "Mosca, Ilaria" <>
To: <>
Sent: Wednesday, January 18, 2006 6:54 AM
Subject: st: Identifying repeated observations in different panels

Dear Statalisters,

I have a database with the following information:

1 10521
1 11546
1 12458
2 74555
2 10521
2 95231

What I would like to know is if there exists some institutions that are
active in more than one province. In the example above such institution
would be the code_institution 10521, which is present both in province 1
and province 2. Probably my question will sound loopy but is there any command that
allows me to do this? Note that I've already dropped all the duplicates
in the data set.
Assuming that such command exists, what can I type next to summarize the
results in a nice table? Namely seeing that the code_institution 10521
is active in province 1 and 2, and so forth.
Thanks in advance for your help,
*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index