Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: How to count countries by year
From
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: How to count countries by year
Date
Fri, 4 Mar 2011 11:36:59 +0000
If you have say -cty2- as well then the solutions may well be quite wrong. Try
egen tag = tag(cty1 year)
egen ncountry = total(tag), by(year)
Otherwise show us the results of
isid cty1 year
duplicates report cty1 year
Nick
On Fri, Mar 4, 2011 at 11:14 AM, emanuele mazzini
<[email protected]> wrote:
> Hi Chris,
> yes, but still it results in the same number I was obtaining before.
> It is curious, as it is a typical bilateral dataset (i.e. that of
> Barbieri, if you know that).
> Do you have any idea about where I can be wrong?
>
> 2011/3/4 emanuele mazzini <[email protected]>:
>> Hi there.
>> I occurred in a little problem in counting the observations of my
>> dataset. I have panel data and need to count how many countries are
>> there for each year. I tried with the following command (assuming that
>> cty1 is the name of each country):
>>
>> bys year: count if cty1[_n]!= cty1[_n-1]
>>
>> but Stata gives a result which is not what I was expecting.
*
* 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/