Thank you! I accepted this as an answer due to its brevity and updated it for my use case: data w;
str1='It looks like SAS is the way to go I love SAS oh yasss SAS woohoo SAS';
str2=tranwrd(str1,'SAS','01'x);
do i=1 to countw(str1,'SAS');
str3=trim(scan(str2,i,'01'x));
if str3 ne ' ' then putlog str3=;
output;
end;
keep str1 i str3;
run;
proc transpose data=w label=i name=str1 prefix=str3;
run;
... View more