Dear SAS Programmers, I need help to write a code that creates indentification for nonsuccessive values. Here is a sample of my dataset: Date time ex_value op_type TYPE matched 01/01/2020 8:30 20 C Q 1 01/01/2020 8:32 20 C Q 1 01/01/2020 8:34 65 C T 8 01/01/2020 8:36 65 C T 12 01/01/2020 8:39 72 C T 10 01/01/2020 8:59 72 P Q 1 01/01/2020 9:09 72 P Q 1 01/01/2020 10:09 72 P Q 1 01/01/2020 10:19 72 P Q 1 01/01/2020 10:29 72 P T 58 01/01/2020 10:29 72 P T 35 * My identifiers are date, ex_value and op_type. * Using the TYPE variable as an identifier will mess up the time chronology (or the time variable) * Now I want to create an identifier for the matched variable (Let's call this new identifier variable Matched_ID) with successive values of 1 (also identified by TYPE = "Q") so that the data will look like: Date time ex_value op_type TYPE matched Matched_ID 01/01/2020 8:30 20 C Q 1 1 01/01/2020 8:32 20 C Q 1 1 01/01/2020 8:34 65 C T 8 . 01/01/2020 8:36 65 C T 12 . 01/01/2020 8:39 72 C T 10 . 01/01/2020 8:59 72 P Q 1 2 01/01/2020 9:09 72 P Q 1 2 01/01/2020 10:09 72 P Q 1 2 01/01/2020 10:19 72 P Q 1 2 01/01/2020 10:29 72 P T 58 . 01/01/2020 10:29 72 P T 35 . Thanks all.
... View more