Hi. I have data over time that contains the day someone initiated care (StartDate, DATE9.), how long they received care during that encounter (days_in_care, Num type), and the corresponding diagnosis for that visit (dx_1, Num type and the value is either 1 or 0 since only 1 diagnosis is tracked given the patient population). I've created two files ('same' contains everyone with the same diagnosis over time, 'not_same' contains everyone with diagnoses that change over time). I am interested in exploring patterns of how the diagnosis variable changes. Beyond the variables above, the ID is a character variable, and the data are arrayed in a long file--one row per encounter (the most encounters in the 'not_same' file for any individual is 40 and there are ~90 people in the dataset). I am struggling to implement code that: effectively displays the various visual patterns of 0s and 1s over time in 'not_same', including how many different pattern 'types' there are. For example, some data patterns will look like 0,0,0,0,1,1,1,1,1 and others will look like 1,1,1,0,1,0, etc. Any advice on ways to display multiple patterns of data? then counts and sums the number of visits and days until a diagnosis changes from 0 to 1 (i.e., want_lag_days and want_lag_encounters). Sample data: ID (character) StartDate (DATE9.) dx_1 (numeric, 0/1) days_in_care (numeric, ranges from 0, released in under 24 hours to 352) want_lag_days want_lag_encounters ff52fc4315ddb 11Sep2016 0 15 16 2 ff52fc4315ddb 18Nov2016 0 1 16 2 ff52fc4315ddb 19Dec2016 1 217 16 2 ff52fc4315ddb 16Aug2017 1 7 16 2 593f1e8e2615 16Jul2015 0 174 179 3 593f1e8e2615 9Jan2018 0 1 179 3 593f1e8e2615 9Nov2018 0 4 179 3 593f1e8e2615 8Apr2019 1 7 179 3 Thank you for any suggestions!
... View more