Is it possible to get all combinations of two word string in SAS and print it in log
E.g. My string is always
Codes find
And I want output like
Codes Find
cOdes fInd
CoDeS fiNd
.
.
.
Like this. My string contains 2 words. First word of 5 letters then a blank space and then 4 letter word.
I know that we can use regex for this . But somehow I am unable to get it solved.
Many thanks in advance
Not really. PRX is hard for this, But easy for data step:
data have;
string='Codes find';
run;
data _null_;
set have;
call symputx('n',length(string));
run;
data want;
set have;
array x{&n};
n=dim(x);
k=-1;
nsubs=2**n;
do i=1 to nsubs;
string=lowcase(string);
rc=graycode(k, of x{*});
do j=1 to dim(x);
if x{j}=1 then substr(string,j,1)=upcase(substr(string,j,1));
end;
output;
end;
keep string;
run;
Xia Keshan
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.