Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: adding across variables


From   TEWODAJ MOGUES <tmogues@students.wisc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: adding across variables
Date   Wed, 03 Mar 2004 18:46:37 -0600

Hi,
This is probably simple but I’ve spent too much time trying to figure it out: If I have a dataset like this:

Id  inc1  inc2
1    12      .
2    3       5
3    .       9

and I want to create a new var that adds up inc1 and inc2 by typing “gen total_inc = inc1+inc2”
I get 
Total_inc
.
8
.
instead of 
Total_inc
12
8
9

Is there no other way than converting missing values to zero, which I really would rather not do?

Thanks,
Tewodaj


~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~
Tewodaj Mogues
Dept. of Agricultural and Applied Economics
University of Wisconsin - Madison
427 Lorch St. #317, Taylor Hall
Madison, WI 53706


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index