Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Optimizing recoding procedures


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: Optimizing recoding procedures
Date   Tue, 11 Dec 2012 14:08:07 -0500

Nick--
Sorry, misread the original post.
OP should worry about what happens with missing values in the various
comparisons...

On Tue, Dec 11, 2012 at 1:54 PM, Nick Cox <[email protected]> wrote:
> Not so; -inlist()- is "or" function not an "and" function.
>
> Flipping the arguments round doesn't change that.
>
> Nick
>
> On Tue, Dec 11, 2012 at 6:50 PM, Austin Nichols <[email protected]> wrote:
>> Thomas Lux <[email protected]>:
>> Try:
>> replace x=0 if inlist(1,a,b,c,d)
>>
>> On Tue, Dec 11, 2012 at 1:09 PM, Nick Cox <[email protected]> wrote:
>>> d == 1 & d == 1
>>>
>>> can be simplified to
>>>
>>> d == 1
>>>
>>> Otherwise I don't know a shorter way to write that. StataCorp could
>>> invent dozens of functions that would only be used occasionally, and
>>> this is I guess one function they did not invent.
>>>
>>> You are correct that there is a -rany()- function in -egenmore-,  but
>>> -ral()- is still a typo. Please explain _where_ user-written programs
>>> that you refer to come from.
>>>
>>> Nick
>>>
>>> On Tue, Dec 11, 2012 at 6:00 PM, Thomas Lux <[email protected]> wrote:
>>>> Thank you very much, Nick!
>>>>
>>>> The mentioned statement makes indeed no sense.
>>>>
>>>> The statement should be
>>>>
>>>>
>>>> replace x = 0 if a==1 & b==1 & c==1 & d==1 & d==1
>>>>
>>>> Is there a way to do this in a shorter way?
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index