Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Joe Canner <jcanner1@jhmi.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | RE: st: RE: Patient age at first cancer exam in STATA |
Date | Sun, 12 Jan 2014 00:16:48 +0000 |
John, The variable DateCancerDx is the date of the first cancer exam. However, I just realized that it is only defined when Cancer==1. To define it for all records, try adding the following: bysort Patid: egen DateFirstCancerDx=min(DateCancerDx) For patients who have some records with Cancer==0 and some with Cancer==1 it will set DateFirstCancerDx to DateCancerDx for all records. If all records for a patient have Cancer==0 DateFirstCancerDx will remain missing. To determine the number of days for which there was a cancer exam, try: bysort Patid: egen nCancerExam=total(Cancer) If by "unique" you mean that there might be might be patients with more than one exam on the same day and you only want to count that day once, let us know, since that is more complicated (or, at least, I will have to think a bit longer about it). Regards, Joe ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] on behalf of mafotb@gmail.com [mafotb@gmail.com] Sent: Saturday, January 11, 2014 6:54 PM To: statalist@hsphsun2.harvard.edu Subject: Re: st: RE: Patient age at first cancer exam in STATA Dear Joe, Not all of these patients have cancer, so Dateexam means that on this date the patient underwent some medical procedure, but it doesn’t necessary mean that it was an exam for cancer. It could as well be hip replacement (or any other medical intervention). It worked thank you very much. Would you possible also know how to: 1. create a variable, which would put instead of the patients age the DATE OF FIRST CANCER EXAM? 2. count number of unique days for which there was a cancer exam? I am so grateful for your help and will be even more. You are saving my life. Kind Regards John Cybulski * * 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/