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: RE: Patient age at first cancer exam in STATA
From
Joe Canner <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: RE: Patient age at first cancer exam in STATA
Date
Sun, 12 Jan 2014 01:52:43 +0000
John,
The simplest way to do what you are asking is to create a data set that has one record per patient, For that try:
bysort Patid: keep if _n==1
This keeps the first record for each patient, which includes the age and count variables we created. Then you can calculated means from that dataset.
Also take a look at the -collapse- command which is useful for creating single record per subject datasets from multiple record per subject datasets.
Regards,
Joe
________________________________________
From: [email protected] [[email protected]] on behalf of [email protected] [[email protected]]
Sent: Saturday, January 11, 2014 8:24 PM
To: [email protected]
Subject: Re: st: RE: Patient age at first cancer exam in STATA
Dear Joe,
Perfect, that was incredibly helpful.
The only problem is that, I want to count the mean age at which the
first cancer test was conducted. For that I need in this variable only
one age per patientid (in the row where the first exam was conducted).
The same goes to number of days for which there was a cancer exam,
only one number per patientid (in any row)
Once again thank you
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/
*
* 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/