<?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: Get the combinations with do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308100#M66066</link>
    <description>&lt;P&gt;You have many SAS programming concepts mixed up in your code. Understanding how the following code works should help you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data design;
call streamInit(7768756); /* seed for random numbers */
do block = 1 to 5;
	do treatment = "A", "B", "C";
		randomDigit = round(rand("UNIFORM"), 0.1);
		output;
		end;
	end;
run;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 29 Oct 2016 21:30:37 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-10-29T21:30:37Z</dc:date>
    <item>
      <title>Get the combinations with do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308090#M66064</link>
      <description>&lt;P&gt;What I want is to create a dataset which has three columns. The first column is digit(1-5). The second column is (A-C). The third column is a random number(0,1)&lt;/P&gt;&lt;P&gt;The sample:&lt;/P&gt;&lt;PRE&gt;1    A    0.1    
1    B    0.2    
1    C    0.5    
2    A    0.8    
2    B    0.3    
2    C    0.5    
3    A    0.2    
3    B    0.2    
3    C    0.3    
...
5    A    0.3    
5    B    0.9    
5    C    0.3    &lt;/PRE&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;data DESIGN(drop=i j k);
array result[3] $ Block Treatment RandomDigit;
do i = 1 to 5;
    do j = 1 to 3;
        do k = 1 to 3;
            if(k=1) then result[i] = i;
            if(k=2) then result[i]=j;
            if(k=3) then result[i]=RAND("Uniform");
         
        end;
    end;
end;
datalines;
run;&lt;/PRE&gt;&lt;P&gt;Thanks for correct my errors.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Oct 2016 17:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308090#M66064</guid>
      <dc:creator>sas_newbie3</dc:creator>
      <dc:date>2016-10-29T17:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get the combinations with do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308100#M66066</link>
      <description>&lt;P&gt;You have many SAS programming concepts mixed up in your code. Understanding how the following code works should help you:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data design;
call streamInit(7768756); /* seed for random numbers */
do block = 1 to 5;
	do treatment = "A", "B", "C";
		randomDigit = round(rand("UNIFORM"), 0.1);
		output;
		end;
	end;
run;

proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Oct 2016 21:30:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308100#M66066</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-10-29T21:30:37Z</dc:date>
    </item>
    <item>
      <title>Re: Get the combinations with do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308190#M66100</link>
      <description>&lt;P&gt;The ability to use lists of values in Do loops and to use Character values as loop indices is one of the nice things about SAS. There were a few times when I was coding in FORTRAN I would cheerfully have taken a compiler designer out for drinks if they would include such things.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Oct 2016 04:20:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Get-the-combinations-with-do-loop/m-p/308190#M66100</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-10-31T04:20:45Z</dc:date>
    </item>
  </channel>
</rss>

