# RE: st: Sums and means within a table

 From "Nick Cox" <[email protected]> To <[email protected]> Subject RE: st: Sums and means within a table Date Thu, 18 Jan 2007 13:56:23 -0000

```In Stata, as in much else, subtraction is obtained with
minus -.

Thus

gen y = x - z

gives the difference between x and z after which
you can -tabulate- y.

Forgive me if I misunderstand your question, but this
does appear to be what you are asking.

On the other hand, if this really is what you are asking,
it is something you should be able to work out
for yourself from the documentation or simple introductions
to Stata.

Nick
[email protected]

Todd Swarthout

> Another simple query
>
> I have two variables 'q28income' and 'q27expenses.'
>
> The command 'tab q28income' gives the following table (I
> print only a part)
>
> tab q28income
>  q28income |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |         72       24.00       24.00
>          10 |          1        0.33       24.33
>          25 |          4        1.33       25.67
>          30 |          1        0.33       26.00
>          40 |          3        1.00       27.00
>
> This says, for example, there are 4 houses with a total
> weekly income of 25 gourdes (Haiti).
>
> The command 'tab q27expenses'gives a similar table.
>
> Id like to have a command that will subtract the expenses
> from the income variable...giving me a net value for the household.
>

*
*   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/
```