Hi, guys,
I would like to measure the percentage of sample firms smaller than the firm for each country in each year.
But I don't know how to use loop to count the number of firms with a smaller asset volume than the specific firm.
For example, for company "01COMMUNIQUE LAB" in 1999, I want to know how many firms are with assets < 2472.
Data:
input name year totass
"01COMMUNIQUE LAB" 1999 2472
"01COMMUNIQUE LAB" 2000 13487
"01COMMUNIQUE LAB" 2001 5145
"01COMMUNIQUE LAB" 2002 2375
"01COMMUNIQUE LAB" 2003 635
"01COMMUNIQUE LAB" 2004 859
"01COMMUNIQUE LAB" 2005 703
"01COMMUNIQUE LAB" 2006 707
"01COMMUNIQUE LAB" 2007 2915
"01COMMUNIQUE LAB" 2008 2157
"0373849 B.C. LTD" 1999 4586
"0373849 B.C. LTD" 2000 4106
"0373849 B.C. LTD" 2001 3659
"0373849 B.C. LTD" 2002 3649
"0373849 B.C. LTD" 2003 7523
"0373849 B.C. LTD" 2004 6165
"0373849 B.C. LTD" 2005 5892
"0373849 B.C. LTD" 2006 18235
"0373849 B.C. LTD" 2007 34371
"0373849 B.C. LTD" 2008 4831
Code:
egen yeargroup = group(year)
sort year
foreach var yeargroup{
gen Size == 0;
if totass[_n] > totass[_n+1]{
relsize ==relsize + 1;
}
}
It turns out not working. Could somebody help me with the commands?
Thanks in advance.
Xiao
Related Posts with Command problem with counting sample firms smaller than the firm for each country in each year (panel data)
Fit plots based on multivariable linear regressionDear community, I would like to create a two-way plot of two continuous variables. STATA's fit plot…
Help in understanding tfdiffDear all, I am trying to understand the tfdiff command before applying it to my data. To do so, I s…
choosing/ extracting the highest value from multiple observationsDear Stata team, I would appreciate it if someone could shed some light on my query below: I have …
Reshaping long data with mtultiple categories into long dataStata 14.0 SE on Mac - Data contais 700,000 obervations Hi. I am trying to reshape a panel of US co…
Multivalued treatment using inverse probability weights in teffectsDear Stata users, I want to estimate the ATE of a new policy on the number of firms, where policy h…
Subscribe to:
Post Comments (Atom)
0 Response to Command problem with counting sample firms smaller than the firm for each country in each year (panel data)
Post a Comment