Sample space = { (0,M), (1,M), (2,M), ......, (50,M) (0,F), (1,F), (2,F), ......, (50,F) }
* log file from a Stata session analyzing the cigs.raw data
. use cigs
. gen byte any = cond(cigs>0,1,0)
. label define sex 1 "men" 2 "women"
. label values dvsex sex
. tab dvsex, summ(cigs)
| Summary of cigs
Sex| Mean Std. Dev. Freq.
------------+------------------------------------
men | 6.5333 10.6017 300
women | 4.8933 8.5900 300
------------+------------------------------------
Total | 5.7133 9.6753 600
. tab dvsex any, row
| any
Sex| 0 1 | Total
-----------+----------------------+----------
men | 201 99 | 300
| 67.00 33.00 | 100.00
-----------+----------------------+----------
women | 214 86 | 300
| 71.33 28.67 | 100.00
-----------+----------------------+----------
Total| 415 185 | 600
| 69.17 30.83 | 100.00
. sort dvsex
. by dvsex: summ cigs if any==1
-> dvsex= men
Variable | Obs Mean Std. Dev. Min Max
---------+-----------------------------------------------------
cigs | 99 19.7980 8.8109 2.0000 50.0000
-> dvsex=women
Variable | Obs Mean Std. Dev. Min Max
---------+-----------------------------------------------------
cigs | 86 17.0698 7.0190 4.0000 35.0000
The tables reveal: