[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Check that recode work

From   Maarten buis <>
Subject   Re: st: Check that recode work
Date   Tue, 10 Mar 2009 13:21:46 +0000 (GMT)

--- On Tue, 10/3/09, Tomas Lind wrote:
> I would like to see the value of Z for combinations of A
> and B  (or for combinations of A, B and C). Missing should be 
> regarded as a category.

You can use -tab- with the -bys- prefix and the -missing- 
option, like in the example below. I also find it useful 
in this kind of datapreparation tasks to include several 
-assert- statements. Those -assert- have saved me a 
couple of times. For more, see: 
Gould, William (2003) "Stata tip 3: How to be assertive", 
The Stata Journal, 3(4): 448.

*--------------- begin example ---------------------
sysuse auto, clear
sum price , meanonly
gen expensive = price > r(mean) if price < .
bys expensive: tab rep78 foreign, missing
assert foreign == 0 if expensive == 0 & rep78 == 1
*----------------- end example ---------------------
(For more on how to use examples I sent to the Statalist, see )

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen


*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index