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: Identifying Experiment subjects that belong in both the Placebo and Experiment Groups


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Identifying Experiment subjects that belong in both the Placebo and Experiment Groups
Date   Sun, 21 Oct 2012 12:44:33 +0100

This is an FAQ. See

How do I list observations in a group that differ on a variable?
http://www.stata.com/support/faqs/data-management/listing-observations-in-group/

bysort ID (Received) : gen bad = Received[1] != Received[_N]

Nick

On Sun, Oct 21, 2012 at 12:38 PM, Beatrice Benavidez
<[email protected]> wrote:

> I have a dataset like below but for thousands of subjects (IDs).
>
> However, in my experiment a particular subject may have received both
> the treatment and placebo at the same or different dates (such as
> person of ID 2 and ID 1 respectively). This occurrence would then
> invalidate the experiment. I would then like to find a way to identify
> and flag those subjects.
>
> Date          ID          Received
> 1/1             1           Treatment
> 1/1             2           Treatment
> 1/1             2            Placebo
> 17/1           1            Placebo
> 18/1           3            Treatment
>
> I know I'd have to do bysort ID: gen flag = 1 if ...
*
*   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