I am not sure I understand what is your mean completely .
data have;
infile cards dlm=' ';
input year :$20. year_list : $100. ;
cards;
2005M 2005M,2006,2007M,2008,2009,2010,2011M
2005M,2007M 2005M,2006,2007M,2008,2009,2010,2011M
2007M,2011M 2005M,2006,2007M,2008,2009,2010,2011M
;
run;
data want;
set have;
length want $ 200;
first=scan(year,1,',');
s=findw(year_list,strip(first));
temp=substr(year_list,s);
do i=1 to countw(temp,',');
t=scan(temp,i,',');
if not findw(year,strip(t)) then want=catx(',',want,t);
end;
drop t i s temp first ;
run;
... View more