Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Multiple record per individual data: Counting frequency in which an individual changes from one variable value to another


From   "Weichle, Thomas" <Thomas.Weichle@va.gov>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Multiple record per individual data: Counting frequency in which an individual changes from one variable value to another
Date   Fri, 5 Aug 2011 16:04:00 -0500

Hi Statalisters,
I have data which contains multiple records per individual.  I have a
categorical variable X (values 1,2,3) which can vary from record to
record within the individual.  I'd like to know if there is a command
that will count the number of times in which an individual changes to a
different value in variable X.  Consider the following example:

study_id 	X
100		2		
100		2
100		2
100		3
555		1
555		1
555		2
555		2
555		1
555		1

study_id 100 would count as 1 change.  
study_id 555 would count as 2 changes.

Tom Weichle
Math Statistician
Center for Management of Complex Chronic Care (CMC3)
Hines VA Hospital, Bldg 1, C202
708-202-8387 ext. 24261
Thomas.Weichle@va.gov 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index