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: Re: Re: st: RE: Patient age at first cancer exam in STATA
From
"[email protected]" <[email protected]>
To
[email protected]
Subject
Re: Re: Re: st: RE: Patient age at first cancer exam in STATA
Date
Sun, 12 Jan 2014 21:45:32 +0100
Dear Joe
You were right again. Thank you, you’ve got an answer to everything.
Maybe you know how to improve my commends in this case:
I’ve got a file cancer.dta
- containing list of medical codes (e.g. 88Zuu00, 25C5.00) that mean a
person has a cancer.
I have also a second file health_record.dta
- with different variables about patient. One of the variables are
medical codes (for cardiovascular disease, diabetes and of course
CANCER).
I want to create a binary variable (flag) that would indicate if a
person has cancer.
So far I did something like this:
gen cancer=.
replace cancer = 1 if medicalcode=="88Zuu00"
replace cancer = 0 if medicalcode !=" 88Zuu00"
replace cancer = 1 if medicalcode =="25C5.00" | medicalcode == "25C5.01" | etc.
But etc. in this case means that I have to reaped the command for over
200 cases. Is there a quicker, more sufficient way?
Kind Regards
John
*
* 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/