Thnks for your reply Hereafter: data kpi_data; infile datalines dsd truncover; input SubjectId :8. differences_in_days :8. flag_KPI :8.; datalines; 1,-21,1 1,-14,1 1,-7,1 2,-16,1 2,0,1 2,6,1 3,-16, 3,-9,1 3,5, 4,1, 5,-21,1 5,0,1 6,0, 7,-11, 7,1, 7,6, 8,-21,1 8,-11,1 8,0,1 9,-14, 9,-9, 9,-6, 9,1, 9,2, 10,-19, 10,-14, 10,-8,1 10,-5, 10,0, 11,-10, 11,-3,1 11,0,1 11,7, 12,-21,1 12,-4,1 12,1,1 12,2,1 12,2,1 12,7, 13,-15,1 13,2, 14,-15,1 14,-8, 14,3,1 15,-8, 15,1,1 16,-18,1 16,-15,1 16,-11, 16,-8,1 16,-4, 16,-3, 16,-2, 16,-1,1 16,5,1 16,6,1 17,-20,1 17,-14,1 17,-7,1 17,0,1 17,7,1 18,-21,1 18,-20,1 18,-13,1 18,-4,1 18,0,1 18,4,1 18,7,1 13,-17,1 13,-1,1 14,-15,1 14,-8,1 14,0,1 14,7,1 15,-21,1 15,-13,1 15,0,1 16,-21,1 16,-14,1 16,-7,1 16,0,1 16,1,1 17,-16, 17,-9, 17,-2, 17,0, 17,3, 17,4, 18,-17,1 18,-5,1 18,-2, 18,2, 18,5, 19,-15, 19,-1,1 20,-6, 20,-2, 20,6, 21,-21, 21,-20, 21,-18,1 21,-7,1 22,-20,1 22,-15,1 22,-6,1 22,4, 23,-18, 23,-14, 23,-11, 23,1,1 24,-14,1 24,-10,1 24,5,1 25,-1,1 25,-18, 25,-3, 26,-15, 26,0,1 27,-3,1 27,-4,1 28,-14,1 28,3,1 29,-10,1 29,6,1 30,-14,1 30,-11, 30,-8, 30,-1,1 30,3,1 ; run; I tried using retain by creating two counters (one for days < 0 and one for days ≥ 0), but I wasn’t successful. Thanks for any help
... View more