Hi Astounding, In response to your questions - When should the program return a 0? When ALL future years contain 1, or when ANY future years contain 1? Return a 0 if ANY future years contain 1 What should the program return when future years contain something else other than 1? All future years for the variable contain either a 0 or 1. If all future years contain 0, then return 1 otherwise return 0 What is the last year in your data? 1617 though i was hoping the macro is capable to identify the latest year (if at all possible) And just to confirm ... it looks like you are asking for the program to add just 1 new variable to your data set. Is that right? That is correct - if all future years for A_N = 0 then new_variable =1 Are there any other variable names that begin with "a_0" other than these year variables? There are 1.2m observation/clients with and over 300 variables. However, none of these variables share the same "a_0" name. The variables represent services and return 1 if the client had used the service for the given year. Hope this helps to clarify the question!
... View more