# Re: st: Generate a new variable [four firm concentration ratio]

 From n j cox To statalist@hsphsun2.harvard.edu Subject Re: st: Generate a new variable [four firm concentration ratio] Date Mon, 21 Nov 2005 21:31:19 +0000

If the number of consumers is integer, then
just install -rowsort- from SSC.

rowsort F?_mt, gen(s1-s7) descend
gen firstfour = 100 * (s1 + s2 + s3 + s4) / CONSUM_mt

Nick
n.j.cox@durham.ac.uk

ALICE DOBSON

I use stata 9.1

I have an unbalanced panel data of the type:

geographical region (m = 1..1154)
year (t = 1..7)

with the following variables:

total number of consumers in each region (CONSUM_mt)
total number of consumers of seven firms in each region (F1_mt, F2_mt, F3_mt, F4_mt, F5_mt, F6_mt, F7_mt)

I want to calculate the four firm concentration ratio for each region, C4_mt, which is the proportion of the number of consumers of top four firms to the total number of consumers in that region, in percentage

Could anyone be kind enough to help me with this simple calculation?

GEOGREGN YEAR CONSUM F1 F2 F3 F4 F5 F6 F7 C4
M1 1969
M1 1970
M1 1971
M1 1972
M1 1973
M1 1974
M1 1975
M2 1969
M2 1970
M2 1971
M2 1972
.
.
.
.
.
.
.
.

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/