Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | laura hendrix <lhendrix.stata@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: carrying observations forward if criteria met |
Date | Thu, 2 Feb 2012 15:41:01 -0500 |
I have a set of time-series data where patients complete a weekly survey with items describing the severity of 14 symptoms (scoring 1-lowest to 5-highest) for 8 weeks with. It is in wide format, ie idno S1_week1 S2_week1 S3_week1....S1_week2 S2_week2 S3_week3....etc 1 3 2 1 ........ 1 2 3 2 1 1 2 ......... 1 3 4 3 4 etc a score of >=3 is considered clinically relevant. I would like to be able to read across the weeks for each symptom, and as soon as a score of 3 or higher is encountered in the 8 week period, the rest of the values for the period are replaced with this value. for example, if a patient has a score of 3 in week 2, then the scores for that symptom will be replaced with 3 for weeks 3,4,5,6,7, and 8. If there is a higher score in later weeks, it will be overwritten by the first clinically relevant score. This is similar to the "carryforward" ado file but I believe that only replaces missing values? Thanks in advance, Laura Hendrix UNC-Chapel Hill * * 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/