What you could do is sort your data set by patient and date and then
generate a counter variable. For instance:
sort patientID date
by patientID: gen visit = _n
Justin
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Ziad Khatib
Sent: Friday, January 26, 2007 3:11 PM
To: [email protected]
Subject: st: Coding visits per patient
Hi,
I am using Stata 9, and I have data for patients who came to the
clinic on seperate occasions.
I am trying to create new variable, called "visit" and to mark the
"visit number" per patient.
For example:
Patient 1, came on Jan,1, 2007, Feb.1, 2007, March 1, 2007 etc..
How to code "visit" variable to have "1" for Jan.1
"2" for Feb1
"3" for March 1?
etc..
Thank you & best regards from South Africa
ziad
*
* 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/