<?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 The Greplin Programming Challenge in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56644#M12132</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data _null_;
input have : $2000.;
length pw a $ 2000;
len=0;
do i=1 to length(have)-1;
 do j=2 to length(have)-i+1;
&amp;nbsp; a=substr(have,i,j); 
&amp;nbsp; if strip(a)=strip(reverse(a)) then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(a) gt len then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; len=length(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pw=a;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
 end;
end;
put pw=;
datalines;
FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth
;
run;


/*
ranynar











data _null_;
array p{1000000} _temporary_;
 do i=1 to 1000000;
&amp;nbsp; p{i}=i;
 end;
do j=2 to int(sqrt(1000000));
if not missing(p{j}) then do;
&amp;nbsp; do i=j+1 to 1000000;
&amp;nbsp; if not missing(p{i})&amp;nbsp; then do; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if mod(p{i},p{j})=0 then p{i}=.; end;
&amp;nbsp; end;
 end;
end;



array f{30} _temporary_;
a=1;b=1; f{1}=2;f{2}=3;
do _i=3 to dim(f);
 f{_i}=f{_i-1}+f{_i-2};
end;

do x=1 to dim(f);
if f{x} gt 227000 and f{x} in p then do;&amp;nbsp; prime=f{x}+1;leave;end;
end;

do k=2 to 10000;
 if mod(prime,p{k})=0 then sum+k;
end;
put sum=;

run;


/*
prime number=514229

514230

sum=352












data a1(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j});sum=a{i}+a{j};if sum le 99 then output;
 end;
end;
run; 
data a2(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k});sum=a{i}+a{j}+a{k};if sum le 99 then output;
 end;
end;
end;
run; 
data a3(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l});sum=a{i}+a{j}+a{k}+a{l};if sum le 99 then output;
 end;
end;
end;
end;
run;
data a4(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m});sum=a{i}+a{j}+a{k}+a{l}+a{m};if sum le 99 then output;
 end;
end;
end;
end;
end;
run;&amp;nbsp; 
data a5(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do n=m+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m},a{n});sum=a{i}+a{j}+a{k}+a{l}+a{m}+a{n};if sum le 99 then output;
 end;
end;
end;
end;
end;
end;
run;&amp;nbsp; 
data a6(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do n=m+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do o=n+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m},a{n},a{o});sum=a{i}+a{j}+a{k}+a{l}+a{m}+a{n}+a{o};if sum le 99 then output;
 end;
end;
end;
end;
end;
end;
end;
run;&amp;nbsp; 


data list;
 set a1-a6;
run; 

data _null_;
 set list end=last;
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
if sum in a then do;put list sum;count+1;end;
if last then put count=;
run;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
/*
count=179







&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Nov 2011 10:35:09 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2011-11-30T10:35:09Z</dc:date>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56643#M12131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It has been a while since I have posted one of the challenges I typically scour the internet looking for.&amp;nbsp; I found a good new one though that comes in three parts.&amp;nbsp; I will publish them all here but to be fair to the originator they are all part of the Greplin Coding Challenge (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://challenge.greplin.com"&gt;http://challenge.greplin.com&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;The Greplin Programming Challenge&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Level 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Embedded in &lt;A href="http://challenge.greplin.com/static/gettysburg.txt" target="_blank"&gt;this block of text&lt;/A&gt; (I have also attached this file to the post) is the password for level 2.&lt;/P&gt;&lt;P&gt; The password is the longest substring that is the same in reverse.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; As an example, if the input was "I like racecars that go fast"&lt;/P&gt;&lt;P&gt; the password would be "racecar".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Level 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the password for level 3, write code to find the first prime&lt;/P&gt;&lt;P&gt; fibonacci number larger than a given minimum.&amp;nbsp; For example, the first&lt;/P&gt;&lt;P&gt; prime fibonacci number larger than 10 is 13.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will receive additional instructions at that time.&amp;nbsp; For the second portion&lt;/P&gt;&lt;P&gt; of this task, note that for the number 12 we consider the sum of the prime divisors&lt;/P&gt;&lt;P&gt; to be 2 + 3 = 5.&amp;nbsp; We do not include 2 twice even though it divides 12 twice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Step 1. Use your code to compute the smallest prime fibonacci number&lt;/P&gt;&lt;P&gt; greater than 227,000.&amp;nbsp; Call this number X.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Step 2. The password for level 3 is the sum of prime divisors of X + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-- In other words you want to do the following&lt;/P&gt;&lt;P&gt;Step 1. Find smallest prime fibonacci number greater that 227,000&lt;/P&gt;&lt;P&gt;Step 2. Add 1 to the smallest prime fibonacci number found&lt;/P&gt;&lt;P&gt;Step 3. Sum the unique prime divisors of number from step 2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE id="content"&gt;&lt;P&gt;Level 3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;For the final task, you must find all subsets of an array&lt;/PRE&gt;&lt;P&gt; where the largest nu&lt;SPAN&gt; &lt;/SPAN&gt;mber is the sum of the remaining numbers.&lt;/P&gt;&lt;P&gt; For example, for an input of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; (1, 2, 3, 4, 6)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; the subsets would be&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; 1 + 2 = 3&lt;/P&gt;&lt;P&gt; 1 + 3 = 4&lt;/P&gt;&lt;P&gt; 2 + 4 = 6&lt;/P&gt;&lt;P&gt; 1 + 2 + 3 = 6&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Here is the &lt;A href="http://challenge.greplin.com/static/numbers.csv"&gt;list of numbers&lt;/A&gt; (I have also attached this file to the post) you should run your code on.&lt;/P&gt;&lt;P&gt; The password is the number of subsets.&amp;nbsp; In the above case the&lt;/P&gt;&lt;P&gt; answer would be 4.&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;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SPOILER: Below are my answers, I altered the text color so that you should have to highlight the text for it to be visible...&amp;nbsp; Don't cheat &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEVEL 1:&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; lengthlen &lt;STRONG&gt;8&lt;/STRONG&gt; str$ &lt;STRONG&gt;10&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; declarehash ha();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; ha.definekey('len');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; ha.definedata('len','str');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; ha.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; input @;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; do s=&lt;STRONG&gt;1&lt;/STRONG&gt; to length(_infile_)-&lt;STRONG&gt;5&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; do l=&lt;STRONG&gt;5&lt;/STRONG&gt; to &lt;STRONG&gt;10&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; str=substr(_infile_,s,l);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; ifstrip(str)=reverse(strip(str)) then &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;&amp;nbsp; do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; len=length(strip(str));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;&amp;nbsp;&amp;nbsp; ifha.check()&amp;gt;&lt;STRONG&gt;0&lt;/STRONG&gt; thenha.add();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; declarehiter iter('ha');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; rc=iter.last();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; if rc=&lt;STRONG&gt;0&lt;/STRONG&gt; then put str=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt; cards;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: black;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: #000000; font-family: 'Courier New';"&gt;&lt;STRONG&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEVEL 2:&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;STRONG&gt;fcmp&lt;/STRONG&gt;outlib=work.func.cipher;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;function isprime(num);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; n=&lt;STRONG&gt;0&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; j=&lt;STRONG&gt;3&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; do while(j&amp;lt;=int(sqrt(num)) and n=&lt;STRONG&gt;0&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; if mod(num,j)=&lt;STRONG&gt;0&lt;/STRONG&gt; then n+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; j+&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; if n=&lt;STRONG&gt;0&lt;/STRONG&gt; then return(&lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; else return(&lt;STRONG&gt;0&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;endsub;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;%let cmplib=%sysfunc(getoption(cmplib));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;options cmplib=(work.func&amp;amp;cmplib);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; f=&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; do until(f&amp;gt;&lt;STRONG&gt;227000&lt;/STRONG&gt; and isprime(f));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; f=sum(f,lag(f));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; f+&lt;STRONG&gt;1&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; j=&lt;STRONG&gt;3&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; sum=&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; do while(j&amp;lt;=int(sqrt(f)));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; if mod(f,j)=&lt;STRONG&gt;0&lt;/STRONG&gt; and isprime(j) then &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; do;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; sum+j;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; j+&lt;STRONG&gt;2&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; put sum=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LEVEL 3: -- This one turned out to be the shortest answer, but it definitly took me the most thought.&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; array seq[&lt;STRONG&gt;22&lt;/STRONG&gt;] (&lt;STRONG&gt;3&lt;/STRONG&gt; &lt;STRONG&gt;4&lt;/STRONG&gt; &lt;STRONG&gt;914&lt;/STRONG&gt; &lt;STRONG&gt;15&lt;/STRONG&gt; &lt;STRONG&gt;19&lt;/STRONG&gt; &lt;STRONG&gt;28&lt;/STRONG&gt; &lt;STRONG&gt;37&lt;/STRONG&gt; &lt;STRONG&gt;47&lt;/STRONG&gt; &lt;STRONG&gt;50&lt;/STRONG&gt; &lt;STRONG&gt;5456&lt;/STRONG&gt; &lt;STRONG&gt;59&lt;/STRONG&gt; &lt;STRONG&gt;61&lt;/STRONG&gt; &lt;STRONG&gt;70&lt;/STRONG&gt; &lt;STRONG&gt;73&lt;/STRONG&gt; &lt;STRONG&gt;78&lt;/STRONG&gt; &lt;STRONG&gt;81&lt;/STRONG&gt; &lt;STRONG&gt;9295&lt;/STRONG&gt; &lt;STRONG&gt;97&lt;/STRONG&gt; &lt;STRONG&gt;99&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; do i=&lt;STRONG&gt;2&lt;/STRONG&gt; to dim(seq);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; do n=&lt;STRONG&gt;1&lt;/STRONG&gt; to comb(dim(seq),i) while(n&amp;lt;&lt;STRONG&gt;10000&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; call lexcomb(n,i,of seq&lt;LI&gt;);&lt;/LI&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; sum=seq[&lt;STRONG&gt;1&lt;/STRONG&gt;];&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; do s=&lt;STRONG&gt;2&lt;/STRONG&gt; to i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp;&amp;nbsp; sum+seq&lt;S&gt;;&lt;/S&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt;&amp;nbsp; if sum in seq then count+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN style="color: black; background-color: black; font-family: 'Courier New'; font-size: 10pt;"&gt; put count=;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: black; font-size: 10pt; background-color: black; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Nov 2011 21:08:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56643#M12131</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-11-29T21:08:35Z</dc:date>
    </item>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56644#M12132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;data _null_;
input have : $2000.;
length pw a $ 2000;
len=0;
do i=1 to length(have)-1;
 do j=2 to length(have)-i+1;
&amp;nbsp; a=substr(have,i,j); 
&amp;nbsp; if strip(a)=strip(reverse(a)) then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(a) gt len then do;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; len=length(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pw=a;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;
 end;
end;
put pw=;
datalines;
FourscoreandsevenyearsagoourfaathersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastpfullmeasureofdevotionthatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunsderGodshallhaveanewbirthoffreedomandthatgovernmentofthepeoplebythepeopleforthepeopleshallnotperishfromtheearth
;
run;


/*
ranynar











data _null_;
array p{1000000} _temporary_;
 do i=1 to 1000000;
&amp;nbsp; p{i}=i;
 end;
do j=2 to int(sqrt(1000000));
if not missing(p{j}) then do;
&amp;nbsp; do i=j+1 to 1000000;
&amp;nbsp; if not missing(p{i})&amp;nbsp; then do; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if mod(p{i},p{j})=0 then p{i}=.; end;
&amp;nbsp; end;
 end;
end;



array f{30} _temporary_;
a=1;b=1; f{1}=2;f{2}=3;
do _i=3 to dim(f);
 f{_i}=f{_i-1}+f{_i-2};
end;

do x=1 to dim(f);
if f{x} gt 227000 and f{x} in p then do;&amp;nbsp; prime=f{x}+1;leave;end;
end;

do k=2 to 10000;
 if mod(prime,p{k})=0 then sum+k;
end;
put sum=;

run;


/*
prime number=514229

514230

sum=352












data a1(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j});sum=a{i}+a{j};if sum le 99 then output;
 end;
end;
run; 
data a2(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k});sum=a{i}+a{j}+a{k};if sum le 99 then output;
 end;
end;
end;
run; 
data a3(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l});sum=a{i}+a{j}+a{k}+a{l};if sum le 99 then output;
 end;
end;
end;
end;
run;
data a4(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m});sum=a{i}+a{j}+a{k}+a{l}+a{m};if sum le 99 then output;
 end;
end;
end;
end;
end;
run;&amp;nbsp; 
data a5(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do n=m+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m},a{n});sum=a{i}+a{j}+a{k}+a{l}+a{m}+a{n};if sum le 99 then output;
 end;
end;
end;
end;
end;
end;
run;&amp;nbsp; 
data a6(keep=list sum);
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
length list $ 100;
do i=1 to dim(a);
 do j=i+1 to dim(a);
&amp;nbsp; do k=j+1 to dim(a);
&amp;nbsp;&amp;nbsp; do l=k+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp; do m=l+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do n=m+1 to dim(a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do o=n+1 to dim(a);
&amp;nbsp; list=catx('+',a{i},a{j},a{k},a{l},a{m},a{n},a{o});sum=a{i}+a{j}+a{k}+a{l}+a{m}+a{n}+a{o};if sum le 99 then output;
 end;
end;
end;
end;
end;
end;
end;
run;&amp;nbsp; 


data list;
 set a1-a6;
run; 

data _null_;
 set list end=last;
array a{22} _temporary_ (3 4 9 14 15 19 28 37 47 50 54 56 59 61 70 73 78 81 92 95 97 99);
if sum in a then do;put list sum;count+1;end;
if last then put count=;
run;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
/*
count=179







&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;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 10:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56644#M12132</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-11-30T10:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56645#M12133</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very nice work Ksharp!&amp;nbsp; I can always count on you to have a response to my posts!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Matthew Kastin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Nov 2011 15:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56645#M12133</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-11-30T15:36:10Z</dc:date>
    </item>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56646#M12134</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My answer is correct. I have passed by &lt;A class="jive-link-external-small active_link" href="http://challenge.greplin.com/"&gt;http://challenge.greplin.com&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Maybe the data of yours and mine is different.&lt;/P&gt;&lt;P&gt;The following is my winning page.&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;STRONG&gt;The Greplin Programming Challenge&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Congratulations.&amp;nbsp; You completed the challenge.&amp;nbsp; Your completion code is 524-16720-86543.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We'd love to talk to you - send your completion code, the code you wrote&lt;/P&gt;&lt;P&gt; during the challenge, and your resume to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="http://cn.mc157.mail.yahoo.com/mc/compose?to=jobs+i+solved+the+challenge@greplin.com" rel="nofollow" target="_blank"&gt;jobs+i+solved+the+challenge@greplin.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Even if you're not looking for a job, we'd love to hear what you thought&lt;/P&gt;&lt;P&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;about the challenge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 02:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56646#M12134</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-01T02:44:09Z</dc:date>
    </item>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56647#M12135</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Totally my mistake, I read your answer wrong I guess???&amp;nbsp; 179 is absolutly the correct answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 02:56:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56647#M12135</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-12-01T02:56:18Z</dc:date>
    </item>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56648#M12136</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tested it again. No problem.&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;STRONG&gt;The Greplin Programming Challenge&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; The End&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ----------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Congratulations.&amp;nbsp; You completed the challenge.&amp;nbsp; Your completion code is &lt;SPAN id="completion"&gt;93-212-194&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; We'd love to talk to you - send your completion code, the code you wrote&lt;/P&gt;&lt;P&gt; during the challenge, and your resume to&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;A href="mailto:jobs+i+solved+the+challenge@greplin.com" id="mail"&gt;jobs+i+solved+the+challenge@greplin.com&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Even if you're not looking for a job, we'd love to hear what you thought&lt;/P&gt;&lt;P&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;about the challenge.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 02:56:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56648#M12136</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-01T02:56:49Z</dc:date>
    </item>
    <item>
      <title>The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56649#M12137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your code for Level 3 is not right.&lt;/P&gt;&lt;P&gt;I run it . It is 172&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 02:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56649#M12137</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-12-01T02:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: The Greplin Programming Challenge</title>
      <link>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56650#M12138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, the version I posted originally was incorrect, I pasted the wrong one.&amp;nbsp; The iterations were cut too short, I fixed it with the proper version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Even so, my program for the third step is not good, right, wrong or indifferent as in my opinion I only happen upon the proper answer by happenstance.&amp;nbsp; It is probable, in my mind, that should I allow more iterations it will generate count&amp;gt;179 and be wrong again...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Dec 2011 03:04:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/The-Greplin-Programming-Challenge/m-p/56650#M12138</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-12-01T03:04:41Z</dc:date>
    </item>
  </channel>
</rss>

