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/