Hi!
I am fairly new to STATA. I need to calculate INDUSTRY sales growth rate for each observation (the sales growth rate command doesn't work for the following situation). To make you better understand my problem kindly see below.
Currently this is what I have -
gvkey fyear sale sic IndCode sumSale
4597 1974 3.742 100 10 241.172
10802 1974 237.43 100 10 241.172
4597 1975 3.549 100 10 4314.787
5416 1975 3.176 100 10 4314.787
1464 1975 33.714 100 10 4314.787
1266 1975 6.656 100 10 4314.787
8596 1975 171.027 100 10 4314.787
2812 1975 843.051 100 10 4314.787
6063 1975 138.342 100 10 4314.787
10802 1975 199.965 100 10 4314.787
9146 1975 43.469 100 10 4314.787
10971 1975 191.768 100 10 4314.787
7986 1975 167.555 100 10 4314.787
9391 1975 7.54 100 10 4314.787
10390 1975 22.589 100 10 4314.787
10884 1975 2186.52 100 10 4314.787
2385 1975 287.535 100 10 4314.787
8057 1975 8.326 100 10 4314.787
2608 1974 218.939 200 20 234.037
4576 1974 1.967 200 20 234.037
1199 1974 13.131 200 20 234.037
5611 1975 13.838 200 20 393.478
8761 1975 40.307 200 20 393.478
11393 1975 43.909 200 20 393.478
4576 1975 3.557 200 20 393.478
What I need is following-
gvkey fyear sale sic IndCode sumSale INUDs_Growth
4597 1974 3.742 100 10 241.172 0
10802 1974 237.43 100 10 241.172 0
4597 1975 3.549 100 10 4314.787 16.8909
5416 1975 3.176 100 10 4314.787 16.8909
1464 1975 33.714 100 10 4314.787 16.8909
1266 1975 6.656 100 10 4314.787 16.8909
8596 1975 171.027 100 10 4314.787 16.8909
2812 1975 843.051 100 10 4314.787 16.8909
6063 1975 138.342 100 10 4314.787 16.8909
10802 1975 199.965 100 10 4314.787 16.8909
9146 1975 43.469 100 10 4314.787 16.8909
10971 1975 191.768 100 10 4314.787 16.8909
7986 1975 167.555 100 10 4314.787 16.8909
9391 1975 7.54 100 10 4314.787 16.8909
10390 1975 22.589 100 10 4314.787 16.8909
10884 1975 2186.52 100 10 4314.787 16.8909
2385 1975 287.535 100 10 4314.787 16.8909
8057 1975 8.326 100 10 4314.787 16.8909
2608 1974 218.939 200 20 234.037 0
4576 1974 1.967 200 20 234.037 0
1199 1974 13.131 200 20 234.037 0
5611 1975 13.838 200 20 393.478 0.68126
8761 1975 40.307 200 20 393.478 0.68126
11393 1975 43.909 200 20 393.478 0.68126
4576 1975 3.557 200 20 393.478 0.68126
Would highly appreciate if anyoen can help me with command
I am fairly new to STATA. I need to calculate INDUSTRY sales growth rate for each observation (the sales growth rate command doesn't work for the following situation). To make you better understand my problem kindly see below.
Currently this is what I have -
gvkey fyear sale sic IndCode sumSale
4597 1974 3.742 100 10 241.172
10802 1974 237.43 100 10 241.172
4597 1975 3.549 100 10 4314.787
5416 1975 3.176 100 10 4314.787
1464 1975 33.714 100 10 4314.787
1266 1975 6.656 100 10 4314.787
8596 1975 171.027 100 10 4314.787
2812 1975 843.051 100 10 4314.787
6063 1975 138.342 100 10 4314.787
10802 1975 199.965 100 10 4314.787
9146 1975 43.469 100 10 4314.787
10971 1975 191.768 100 10 4314.787
7986 1975 167.555 100 10 4314.787
9391 1975 7.54 100 10 4314.787
10390 1975 22.589 100 10 4314.787
10884 1975 2186.52 100 10 4314.787
2385 1975 287.535 100 10 4314.787
8057 1975 8.326 100 10 4314.787
2608 1974 218.939 200 20 234.037
4576 1974 1.967 200 20 234.037
1199 1974 13.131 200 20 234.037
5611 1975 13.838 200 20 393.478
8761 1975 40.307 200 20 393.478
11393 1975 43.909 200 20 393.478
4576 1975 3.557 200 20 393.478
What I need is following-
gvkey fyear sale sic IndCode sumSale INUDs_Growth
4597 1974 3.742 100 10 241.172 0
10802 1974 237.43 100 10 241.172 0
4597 1975 3.549 100 10 4314.787 16.8909
5416 1975 3.176 100 10 4314.787 16.8909
1464 1975 33.714 100 10 4314.787 16.8909
1266 1975 6.656 100 10 4314.787 16.8909
8596 1975 171.027 100 10 4314.787 16.8909
2812 1975 843.051 100 10 4314.787 16.8909
6063 1975 138.342 100 10 4314.787 16.8909
10802 1975 199.965 100 10 4314.787 16.8909
9146 1975 43.469 100 10 4314.787 16.8909
10971 1975 191.768 100 10 4314.787 16.8909
7986 1975 167.555 100 10 4314.787 16.8909
9391 1975 7.54 100 10 4314.787 16.8909
10390 1975 22.589 100 10 4314.787 16.8909
10884 1975 2186.52 100 10 4314.787 16.8909
2385 1975 287.535 100 10 4314.787 16.8909
8057 1975 8.326 100 10 4314.787 16.8909
2608 1974 218.939 200 20 234.037 0
4576 1974 1.967 200 20 234.037 0
1199 1974 13.131 200 20 234.037 0
5611 1975 13.838 200 20 393.478 0.68126
8761 1975 40.307 200 20 393.478 0.68126
11393 1975 43.909 200 20 393.478 0.68126
4576 1975 3.557 200 20 393.478 0.68126
Would highly appreciate if anyoen can help me with command
Comment