Bookmark and Share

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: Counting firms in a panel dataset


From   "Miguel A. Duran" <[email protected]>
To   <[email protected]>
Subject   RE: st: Counting firms in a panel dataset
Date   Thu, 16 Jan 2014 11:36:32 +0100

Thanks, Nick, for your answer. I thought of something similar to what you
propose, but if I am not mistaken it has a problem: I would be counting both
id1 and id2, i.e., I would get again 408 (what I get just using -codebook id
if mean_var1 != 11-).

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

-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Nick Cox
Enviado el: miércoles, 15 de enero de 2014 20:28
Para: [email protected]
Asunto: Re: st: Counting firms in a panel dataset

I'd look at data that satisfy

if mean_var1 != 11 & !(var1 == 10/var2 | var1 == 11/var2)

i.e. negating the second condition. Note that if -var1- and -var2- are both
missing, then the second condition

(var1 == 10/var2 | var1 == 11/var2)

reduces to

. == .

which is always true.
Nick
[email protected]


On 15 January 2014 19:18, Miguel A. Duran <[email protected]> wrote:
> 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/
*
*   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/


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


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index