See this is good example of not clearly stating your question. Posting test data in the form of a datastep - which clearly shows your problem, and what you want at the end is essential to us who cannot guess what you are doing. Now if your problem is a you now describe then a simple datastep:
data want;
set have;
length result $2000;
do i=1 to countw(var1," ");
if index(scan(var1,i," "),"C#") > 0 then result=catx(' ',want,scan(var1,i," "));
end;
run;
This will create a variable result which takes only words from var1 where they contain C#.
... View more