Statalist The Stata Listserver


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

st: RE: Re: Identifying repeated observations in different panels


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: Identifying repeated observations in different panels
Date   Wed, 18 Jan 2006 18:29:20 -0000

Michael's logic is also canned as an 
-egen- functions -nvals()- in the -egenmore-
package downloadable from SSC. 

A relevant FAQ is at 

How do I list observations in a group that differ on a variable?                                                                                                  http://www.stata.com/support/faqs/data/diff.html           

Nick 
[email protected] 

Michael Blasnik
 
> 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

Mosca, Ilaria
 
> > I have a database with the following information:
> > 
> > PROVINCE CODE_INSTITUTION
> > 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. 

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



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