Statalist


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

st: RE: generate sum of variables & ignore missing


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: RE: generate sum of variables & ignore missing
Date   Thu, 5 Jun 2008 14:25:53 +0200

egen varD=rowtotal(varA - varC)

Martin Weiss
_________________________________________________________________

Diplom-Kaufmann Martin Weiss
Mohlstrasse 36
Room 415
72074 Tuebingen
Germany

Fon: 0049-7071-2978184

Home: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1130

Publications: http://www.wiwi.uni-tuebingen.de/cms/index.php?id=1131

SSRN: http://papers.ssrn.com/sol3/cf_dev/AbsByAuth.cfm?per_id=669945

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Andrea Bennett
Sent: Thursday, June 05, 2008 2:24 PM
To: [email protected]
Subject: st: generate sum of variables & ignore missing

Hi,

I guess this is an easy task for somebody more experienced. I have 3  
columns (varA, varB, varC) containing dummy variables (0, 1, missing  
values "."). I would like to generate "varD" the sum of each row, e.g.  
if varA==1 varB==0 varC==1 I should have varD==2. This works clearly  
fine when there are no missing values (varD= varA + varB + varC). But  
is there an easy way to let Stata read a missing value as "0" so that  
varA==1 varB==. varC==1 would result in varD==2 (without actually  
replacing the missing values with "0")? I am trying to get it to work  
with -missing()- but so far have not succeeded.

Many thanks for your consideration,

Andrea
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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