Statalist The Stata Listserver


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

Re: st: Identifying repeated observations in different panels


From   [email protected]
To   [email protected]
Subject   Re: st: Identifying repeated observations in different panels
Date   Wed, 18 Jan 2006 06:43:18 -0600

One way would be to -collapse (count) ..., by(code)- and then -merge- 
with the original dataset.  -tab code province- will show where each 
code is active.

For example:

clear
input province code
1 10521
1 11546
1 12458
2 74555
2 10521
2 95231
3 11111
3 95231
3 10521
end

sort code
save "C:\Documents and Settings\scott.merryman\Desktop\foo.dta", 
replace
collapse (count) count=province, by(code)
sort code
merge code using "C:\Documents and 
Settings\scott.merryman\Desktop\foo.dta"

drop _m
sort province 
l, sepby(province)
tab code prov


Hope this helps,
Scott

----- Original Message -----
From: "Mosca, Ilaria" <[email protected]>
Date: Wednesday, January 18, 2006 5:54 am
Subject: st: Identifying repeated observations in different panels

> Dear Statalisters,
> 
> 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 
> institutionwould 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 
> duplicatesin 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,
> Ilaria 

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