<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: print all combinations of upper and lowercase of string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/print-all-combinations-of-upper-and-lowercase-of-string/m-p/210682#M39033</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not really. PRX is hard for this, But easy for data step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
string='Codes find';
run;
data _null_;
 set have;
 call symputx('n',length(string));
run;
data want;
set have;
array x{&amp;amp;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);
&amp;nbsp; if x{j}=1 then substr(string,j,1)=upcase(substr(string,j,1));
 end;
 output;
end;
keep string;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 May 2015 13:15:30 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2015-05-07T13:15:30Z</dc:date>
    <item>
      <title>print all combinations of upper and lowercase of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-all-combinations-of-upper-and-lowercase-of-string/m-p/210681#M39032</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to get all combinations of two word string in SAS and print it in log &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E.g. My string is always &lt;/P&gt;&lt;P&gt;Codes find&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And I want output like &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Codes Find&lt;/P&gt;&lt;P&gt;cOdes fInd&lt;/P&gt;&lt;P&gt;CoDeS fiNd&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like this. My string contains 2 words. First word of 5 letters then a blank space and then 4 letter word.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know that we can use regex for this . But somehow I am unable to get it solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks in advance &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 02:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-all-combinations-of-upper-and-lowercase-of-string/m-p/210681#M39032</guid>
      <dc:creator>forumsguy</dc:creator>
      <dc:date>2015-05-07T02:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: print all combinations of upper and lowercase of string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-all-combinations-of-upper-and-lowercase-of-string/m-p/210682#M39033</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not really. PRX is hard for this, But easy for data step:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
string='Codes find';
run;
data _null_;
 set have;
 call symputx('n',length(string));
run;
data want;
set have;
array x{&amp;amp;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);
&amp;nbsp; if x{j}=1 then substr(string,j,1)=upcase(substr(string,j,1));
 end;
 output;
end;
keep string;
run;


&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 May 2015 13:15:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-all-combinations-of-upper-and-lowercase-of-string/m-p/210682#M39033</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-05-07T13:15:30Z</dc:date>
    </item>
  </channel>
</rss>

