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

RE: st: SUM question

From   "Yamamoto, Satomi" <>
To   "''" <>
Subject   RE: st: SUM question
Date   Wed, 14 May 2008 23:31:44 -0500


Thank you very much for the prompt reply.
I think  egen newvar = rowtotal(var1 var2) is equivalent to replacing missing values with 0(zero).

The SUM function in SPSS adds cases in the variable where at least one observation is valid:

Var 1   Var2
1        4
3        5
4        5
5        8
.        5
.        .

When  compute newvar= sum(var1, var2). is used, there will be 1 missing case.
When compute newvar= var1+var2. is used, there are 2 missing cases.

Do you have any ideas? It would be great if I could get help on this.


-----Original Message-----
From: [] On Behalf Of Richard Williams
Sent: Wednesday, May 14, 2008 11:47 PM
Subject: Re: st: SUM question

At 10:29 PM 5/14/2008, Yamamoto, Satomi wrote:
>I'm wondering if anybody knows the Stata command that is equivalent to
>the following SPSS command:
>compute newvar= sum(var1, var2).
>The SUM function in SPSS allows you to keep cases with missing values
>instaead of droppoing them. It's one way of  preventing listwise
>deletion. It would be great if I can get help with this.

egen newvar = rowtotal(var1 var2)

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu

*   For searches and help try:

*   For searches and help try:

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