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: keeping variables and subjects with specific observations


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: keeping variables and subjects with specific observations
Date   Fri, 18 Oct 2013 01:28:04 +0100

keep if Year == int_year
Nick
njcoxstata@gmail.com


On 18 October 2013 01:07, Nicholas Winters
<nicholas.winters@mail.mcgill.ca> wrote:
> I have a data set with multiple entries per subject, I want to keep only the entries were two variables are equal (Year and int_year). So i want all entries for for all variables in my data set but only for when Year=int_year
>
> data looks like this:
>
> subject          exposure         Year           int_year
> 1                       3                1990            1991
> 1                       4                1991            1991
> 1                       3                1992            1991
> 1                       4                1993            1991
> 2                       3                1990            1990
> 2                       5                1991            1990
> 3                       3                1990            1990
> 3                       4                1991            1992
> 3                       3                1992            1992
>
> Any ideas how?
>
> Nick
> *
> *   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/
*
*   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