Statalist


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

Re: st: Dealing with Missing Values


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Dealing with Missing Values
Date   Fri, 23 May 2008 17:16:54 +0100 (BST)

--- Leonor Saravia <[email protected]> wrote:
> My problem is that I'd like to perform the next indicator:
> 
> gen IB =  (stove + refri + house)/q
> 
> where 'q'  is a number between 1 and 3, depending how many variables
> had values different from missing.
> 
> The data looks like this (and I agregate the value - in fraction -
> for the IB that I would like to create):
> 
> id_household    stove    refri   house      IB
> 1                       1          1       0         2/3
> 2                        0         .        1         1/2
> 3                        .         .         0         0/1

*-------------- begin example ---------------
clear
input id_household    stove    refri   house      
1                       1          1       0      
2                       0          .       1     
3                       .          .       0    
end
egen ib = rowmean(stove refri house)
list
*---------------- end example ---------------
(For more on how to use examples I sent to the Statalist, see
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

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

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail.
A Smarter Email http://uk.docs.yahoo.com/nowyoucan.html
*
*   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