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

Re: st: adding across variables


From   "Dimitriy V. Masterov" <[email protected]>
To   [email protected]
Subject   Re: st: adding across variables
Date   Wed, 3 Mar 2004 18:54:15 -0600 (CST)

try

egen tot_inc=rsum(inc1 inc2)

DVM

On Wed, 3 Mar 2004, TEWODAJ MOGUES wrote:

> 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/
>

_______________________________________________________________________________
Dimitriy V. Masterov

Work:
Center for Social Program Evaluation
1155 East 60th St. Room 038
Chicago, IL 60637
Work: (773)256-6005
Fax: (773)256-6313

Home:
1312 East 53rd St., Apt.309
Chicago, IL 60615
Mobile: (773)220-2760



*
*   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