Statalist


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

Re: st: Replacing values within a matched study


From   "Vladimir V. Dashkeyev" <[email protected]>
To   [email protected]
Subject   Re: st: Replacing values within a matched study
Date   Wed, 28 May 2008 15:52:39 +0400

Nada,

As far as I understand, you need:

by id,s: replace breast=0 if control ==1 & breast ==.
by id,s: replace colon=0 if control ==1 & colon ==.
by id,s: replace prostate=0 if control ==1 & prostate ==.

Hope it helps,
Vladimir

On Wed, May 28, 2008 at 3:16 PM, Nada Khan <[email protected]> wrote:
> Hi,
>
> I'm having trouble putting my finger on the solution to what may be a simple problem.
>
> I have a matched case control dataset with patients who have had breast, colon or prostate cancer with 4 matched controls each and a matching variable (groupid).  My data looks like this:
>
> id    groupid     breast    colon    prostate  control
> 1        1              1            .              .             .
> 2        1              .            .               .             1
> 3        1              .             .              .             1
> 4        1              .             .               .            1
> .
> .
> .
> 89     40             .             1              .             .
> 90     40            .              .               .             1
> 91     40            .              .              .              1
> etc
>
> What I'm trying to do is replace breast = 0 for each control, or colon= 0 for each control, so that my data would look like this:
>
> id    groupid     breast    colon    prostate  control
> 1        1              1            .              .             .
> 2        1              0            .               .             1
> 3        1              0             .              .             1
> 4        1              0            .               .             1
> .
> .
> .
> 89     40             .             1              .             .
> 90     40            .              0               .             1
> 91     40            .              0              .              1
> etc
>
> I can't seem to get the right combination of gen/replace/bys commands.  Can anyone help?
>
> Thanks!
> Nada
>
>
>
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index