Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: RE: Re: match values of several variables


From   "Cris Dogaru (Oregon State University)" <statamplus@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Re: match values of several variables
Date   Thu, 29 Apr 2010 09:51:09 +0200

Thank you very much - I think this is a very short and elegant sollution
Cris

On Fri, Apr 23, 2010 at 1:02 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote:
> Note that this can be trimmed to
>
> list if (max(<whatever) - min(<whatever>)) > 0
>
> although the <whatever> inevitably lengthen the command.
>
> Nick
> n.j.cox@durham.ac.uk
>
> Irene Moral
>
> perhaps you can try to compute
>
> var1=max( birthyear_98, birthyear_99.......)
>
> and
>
> var2=min( birthyear_98, birthyear_99......)
>
> and var3=var1-var2
>
> and then recode var3 if var3=0, they match, if var3<0|var3>0 they don't
> match
>
> is this useful for your purpouse?
>
> From: "Cris Dogaru (Oregon State University)" <statamplus@gmail.com>
>
>> I have a longitudinal data in which they asked, at different data
>> collection points, the year of birth for the subject's mother; the
>> variables are named based on the year of data collection (i.e.,
>> birthyear_98, birthyear_99, etc).
>> One would expect the values of these varables to match (if it's the
>> same person), but they don't. I'd like to find an easy way to check if
>> several variables have the same value or not, irrespective of the
>> missing values. For now I am using the grouping () option in egen, and
>> recode by hand the mismatched cases. However, as I am adding new cases
>> to the dataset, the coding needs to be redone every time.
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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   |   Site index