Andreas Aschbacher wrote:
> Dear collegues !
> I want to add the column > 100 - Cum <
> to the following table which I get with tab z1
>
> . tab z1
>
> z1 | Freq. Percent Cum.
> 100 - Cum
> ------------------------------+-----------------------------------
> 1. < 20 mSv | 2,086 0.52 0.52
> 99.48
> 2. >= 20 mSv | 32,767 8.21 8.73
> ..
> 3. >= 40 mSv | 105,238 26.35 35.08
> ..
> 4. >= 60 mSv | 122,592 30.70 65.78
> ..
> 5. >= 80 mSv | 77,056 19.30 85.08
> ..
> 6. >= 100 mSv | 31,572 7.91 92.99
> 7.01
> ........ ........ .....
> ....... ......
>
> How to get the table with 100 - Cum inclusive ?
> Thank you very much
> andreas
I propose to form a dataset containig the results and and to display this
dataset either with -list- or -tabdisp-. You may also transfer the dataset
with the results to a Desktop Publishing Program with -outsheet-.
The following may deal as a starting point:
--------------------------------------
contract z1, freq(n)
gen N = sum(n)
gen f = n/N[_N] * 100
gen F = sum(f)
gen F100 = 100 - F
tabdisp z1, cellvar(n f F F100)
-------------------------------------
Be aware that -contract- changes your dataset. You should therefore save you
data before using the above.
Andreas might also like to check out my -xcontract- package, downloadable
from SSC. -xcontract- is an extended version of -contract-, which produces
an output data set containing frequencies, percentages and (optionally)
cumulative frequencies and percentages. The user may list this output data
set, save to a disk file, or write it to memory, overwriting any
pre-existing data.