Statalist The Stata Listserver


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

Re: st: egen rowmin rowmax


From   Teresa Dale Nelson <tdale@utdallas.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: egen rowmin rowmax
Date   Sat, 4 Nov 2006 19:23:43 -0600 (CST)

Thanks Quang, Michael and Philipp,  for your insights.

As it turns out, egen [var] = rowsum([varlist]) is equivalent to 
egen [var] = total([varlist]).

My solution turned out to be to replace all of the zeros  in the seq* 
cells with missings, then execute 
egen byte minmath = rowmin(seq*) /*without the condition!*/
and add the following line of code:
replace minmath = 0 if minmath==.

Happiness!
Best,
Terri

Quang Nguyen wrote:


>Dear Terri,
>
>Could you try this:
>
>egen rowsum=rowsum(seq*)
>egen byte minmath = rowmin(seq*) if rowsum~=0
>
>Please note that minmath is greater than zero iff ALL scores for this
>observation is greater than zero.
>
>On 11/4/06, Teresa Dale Nelson <tdale@utdallas.edu> wrote:
>> Hi Michael,
>>
>> I believe the condition that rowsum not equal zero would take care of
>> that. Do you have a thought about this conditionality that I'm missing?
>>
>> egen byte minmath = rowmin(mathseq*) if rowsum~=0
>>
>> Thanks,
>> Terri
>>
>> Michael Blasnik wrote:
>>
>>
>> >...
>> >It looks like the rowmin should always be zero or missing -- at least
>> if
>> >your description of the data is accurate.  How could the rowmin be
>> larger
>> >than zero if all of the rows contain at least a zero?
>> >
>> >Michael Blasnik
>> >
>> >----- Original Message -----
>> >From: "Teresa Dale Nelson" <tdale@utdallas.edu>
>> >To: <statalist@hsphsun2.harvard.edu>
>> >Sent: Saturday, November 04, 2006 6:30 PM
>> >Subject: Re: st: egen rowmin rowmax
>> >
>> >
>> ><snip> Instead, the var for egen var=rowmin(varlist) is evaluated to
>> zero or
>> >missing.  In fact, some of
>> > the rows have all zeroes; the rest contain some zeroes and a few
>> values
>> >between 1 and 13.
>> ><snip>
>> >
>> >*
>> >*   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:
>*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index