Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# st: calculation 'cross differences'

 From Mario Jose To statalist@hsphsun2.harvard.edu Subject st: calculation 'cross differences' Date Thu, 18 Apr 2013 11:59:08 +0100

```Dear all,

I have a sample of companies that are subject to different tax rates,
they are owned by different parent companies. I would like to compute
differences of tax rates within each group and in the perspective of
each company. Below is an example of the database and a view of what I
would like to compute:

group company  taxrate
1                 A              15
1                 B              10
1                 C              20
2                 D              20
2                 E              15
2                 F              14
2                 G              30

The task I need to do is calculate the following regarding for
instance companies A, B and C of group 1:

A=> (15-10) + (15-20)
B=> (10-15) + (10-20)
C=> (20-15) + (20-10)

As I have thousands of companies it is a hard to do this manually, is
there any suggestion on how to handle with this calculations?

I would appreciate any help.

Best regards,
MJ
*
*   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/
```