Hi Collegues; I have this data set - note it has 4 accounts. data a; informat Current_date date9.; Input Current_date Account_number $11-13 Arrears_Band $ 15-21; Format Current_date date9.; cards; 28FEB2010 111 NPNA 31MAR2010 111 Current 30APR2010 111 30 - 60 28FEB2010 444 Current 31MAR2010 444 30 - 60 30APR2010 444 30 - 60 31MAY2010 444 Current 31OCT2010 444 Current 31DEC2010 444 Current 31JAN2011 444 1 - 30 28FEB2011 444 30 - 60 31MAR2011 444 60 - 90 30JUN2011 444 90 + 31JUL2011 444 NPNA 31AUG2011 444 NPNA 28FEB2010 555 30 - 60 31MAR2010 555 30 - 60 30APR2010 555 60 - 90 31MAY2010 555 NPNA 31AUG2011 555 90 + 30SEP2011 555 NPNA 31MAY2010 666 Current 31AUG2011 666 90 + 30SEP2011 666 Current ; run; Question: I want to remove any Account_number that has fallen at least once from a "non 90 +” Arrears_Band to NPNA Answer Based on this condition, Account_number 555 has to be removed. My appraoch 1. I have used the below code helped by PG Stat to track how each account has successively fallen across different Arrears_Bands. 2. Then visually spotted the account_numbers that satisfy the above condition. 3. Finally, I did a "sub setting if" step, using those spotted account_numbers. But I have a huge data set which takes time to do this. Could any one suggest an efficient alternative for the last step? I used this approach. proc sort data=a; by account_number Current_date; run; data cat(keep=account_number category); length Category $200; do until(last.account_number); do until (last.Arrears_Band); set a; by account_number Arrears_Band notsorted; end; category = catx(" to ", category, Arrears_Band); end; run; data b; set a; if account_number not in ('555'); run; /*Thanks Mirisage
... View more