[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: egen rowsum, and missing values

From   Maarten buis <>
Subject   Re: st: egen rowsum, and missing values
Date   Thu, 2 Oct 2008 22:18:02 +0100 (BST)

--- Nirali Shah <> wrote:
> I find the egen commands to be very useful, especially the rowsum  
> operation, which treats missing values as 0.  However, I accidentally
> discovered an aspect of this operation which has me baffled.
> In my data set, I have two types of missing values - missing due to  
> non-response, and missing due to a skip pattern.  I'd like to keep  
> them separate, for tabulations and other purposes.  The missing due
> to a skip pattern I have coded as ".a", and the regular missing
> as "."  (As numbers, not text).
> Egen rowsum appears to treat my ".a" missing values as the number 56.
> Does anyone know why it does this? Do you have any suggestions for  
> getting around this and still allowing me to keep the two different  
> types of missing data codes?

I am assuming that you are referring to -egen rowtotal-. If that is the
case then I am not able to reproduce your problem. Can you run the
example below and confirm that the problem you report also occurs in
this example?

*--------- begin example ------------
drop _all
set obs 1
gen mis = .
gen a = .a
egen sum = rowtotal(mis a)
*---------- end example ------------
(For more on how to use examples I sent to the Statalist, see )

-- Maarten

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

*   For searches and help try:

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