Hello,
I am trying to tackle a problem in SAS. I have a dataset that has 1 row per ID. All of the rest of the variables are coded with a 0 or 1. What I am trying to do is flag if a member has 31 or more consecutive 0s. However, I only want to count the 0s that are in between each member’s first 1 and last 1.
Example #1: ID #1234’s first 1 is the variable Mar0900 and their last 1 is the variable Apr0900. This person does not have 31+ consecutive 0s in the variables between Mar0900 and Apr0900. Flag=N
Example #2: ID #2222’s first 1 is the variable Mar1000 and their last 1 is the variable Apr1500. This person has 31+ consecutive 0s in the variables between Mar1000 and Apr1500. Flag=Y
Example #3: ID #9876’s first 1 is the variable Apr0900 and their last 1 is the variable Apr1400. This person does not have 31+ consecutive 0s in the variables between Apr0900 and Apr1400. They do have 31+ consecutive 0s, but they happen before their first 1, therefore they do not count. Flag=N
Know of any code that I can use to do this? I would greatly appreciate any help in tackling this problem!
Thank you!
... View more