Hello,
i want to count the total M&A's (labeled as 1 in maactive) of a firm (based on gvkey) en generate a new variable. I tried the code
egen totalma = count (maactive ==1), by (gvkey)
but if I use this code, it counts all of the observations on maactive based on gvkey but I only need the ''1'' of the variable maactive.
Does someone know what I am doing wrong?
Array
Related Posts with counting total of variable based on other variable
Adjacency matrix大家好: 如何使用统计码构建中国各省的(0,1 )空间邻接矩阵 …
Bysort and egen code not carrying over correct dataHello, I have a long data set containing college enrollment data by term, multiple instances per st…
Fix a coefficient to the value it had in previous mlogitHi everyone, this may be a very simple problem and I am just not getting it, but here's what I am t…
Generating IDsDear all, Suppose I have the following dataset Code: clear input var1 var2 1 1 1 2 1 3 1 4 2 1 2 …
Panel Var and Fan ChartsHi all, Its bit urgent please I'm using panel var in my project, i need little help could anyone …
Subscribe to:
Post Comments (Atom)
0 Response to counting total of variable based on other variable
Post a Comment