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]
st: Counting firms in a panel dataset
From
"Miguel A. Duran" <[email protected]>
To
<[email protected]>
Subject
st: Counting firms in a panel dataset
Date
Wed, 15 Jan 2014 20:18:58 +0100
Hi, Statlisters. I am using -codebook- to count the number of agents in a
panel dataset under different criteria. Under a criterion I get 408 agents
and under another one I get 397. I have an intuition about the cause of this
difference and I would like to check it out, but I do not know how to do it.
To help make clear my point, (the relevant part of) my dataset looks similar
to this,
id startdate date var1 var2 mean_var1
1 189 187 10 . 10.75
1 189 188 11 . 10.75
1 189 189 11 1 10.75
1 189 190 11 . 10.75
2 192 189 10 . 10.5
2 192 190 10 . 10.5
2 192 191 11 . 10.5
2 192 193 11 . 10.5
Using the command -codebook id if mean_var1 != 11- I get 408 agents, but
using the command -codebook id if mean_var1 != 11 & (var1 == 10/var2 | var1
== 11/var2)- I get 397 agents. My intuition is that this happens because
there are agents (like agent 2) that do not have the observation
corresponding to the startdate. If I am right adding this requirement to the
command -codebook id if mean_var1 != 11- should count 11 agents, but I do
not know how to include that requirement. Will anyone please help with this?
Thanks in advance.
Miguel.
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/