[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: how to cope with missing value in my case
The following is my conclusion:
Use egen rowtotal (varlist) in early version of Stata
Use enen rsum(varlist) in verstion after Stata8
"This command creates the horizontal sum of its arguments" and
"missings are treated as zero"------quoted from manual -egen-
Thanks to Richard Goldenstein, Den Fei and Svend.
On 10/7/05, Fei Deng <firstname.lastname@example.org> wrote:
> It is quite common for STATA to give a missing value if any of you
> variable in the adding is missing. One way you might try it like this:
> replace var1=0 if var1==.
> replace var2=0 if var2==.
> replace var3=0 if var3==.
> gen var4=var1+var2+var3
> Hope it helps.
> On Fri, 7 Oct 2005, Jia Xiangping wrote:
> > Dear all,
> > I came across a problem about missing value. For example:(var1 var2
> > var3 are categorical variables)
> > index var1 var 2 var3 var 4
> > 1 . 1 1
> > 2 1 1 .
> > 3 . 1 1
> > Now I want to get the frequecy of each observation and generate a
> > variable var4 which is the sum of frequency. So when I run -gen
> > var4=var1+var2+var3-, I should have got 2,2,1. But I got three missing
> > value. I'd like to say this problem is quite typical for missing value
> > topic. I tried to find answer online. But no clue now. Does anybody
> > can help me? Thanks
> > --
> > Xiangping JIA
> > *
> > * 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/
* For searches and help try: