<?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: do loops basic question in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73469#M21287</link>
    <description>Here's some options:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data mydata;&lt;BR /&gt;
    set mydata;&lt;BR /&gt;
    do i=1,3,5,8,6,13;&lt;BR /&gt;
       *-- do stuff with i here --;&lt;BR /&gt;
       put i=;&lt;BR /&gt;
    end;&lt;BR /&gt;
    *-- yet another option --;&lt;BR /&gt;
    do mm='Dec','Jan','Aug','Feb';  *-- no particular order --;&lt;BR /&gt;
       *-- do stuff with mm here --;&lt;BR /&gt;
       put mm=;&lt;BR /&gt;
    end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro myloop;&lt;BR /&gt;
    %let index = 1 3 6 9 2 7;&lt;BR /&gt;
    %do i=1 %to 6;  %*best to calculate the dimension of index;&lt;BR /&gt;
        %let idx = %scan( &amp;amp;index, &amp;amp;i, %str( ));&lt;BR /&gt;
        %*-- do stuff with &amp;amp;idx here ---;&lt;BR /&gt;
        %put idx=&amp;amp;idx;&lt;BR /&gt;
    %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%myloop&lt;BR /&gt;
[/pre]</description>
    <pubDate>Tue, 21 Sep 2010 00:32:28 GMT</pubDate>
    <dc:creator>WaltSmith</dc:creator>
    <dc:date>2010-09-21T00:32:28Z</dc:date>
    <item>
      <title>do loops basic question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73466#M21284</link>
      <description>all-&lt;BR /&gt;
&lt;BR /&gt;
is there a way to tell a do loop to reference a vector of numbers for its in index? In other words lets say I have a vector index={3 5 6 7 12 3}. I want the do loop to go through i=3,5,6,7,.... instead of 1,2,3,4,5,.....&lt;BR /&gt;
&lt;BR /&gt;
cheers</description>
      <pubDate>Mon, 20 Sep 2010 23:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73466#M21284</guid>
      <dc:creator>trekvana</dc:creator>
      <dc:date>2010-09-20T23:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: do loops basic question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73467#M21285</link>
      <description>data step loop? or macro loop?</description>
      <pubDate>Tue, 21 Sep 2010 00:20:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73467#M21285</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2010-09-21T00:20:12Z</dc:date>
    </item>
    <item>
      <title>Re: do loops basic question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73468#M21286</link>
      <description>Hi:&lt;BR /&gt;
  In a DATA step program, you can provide a list of numbers or character values to be used in a DATA step DO loop, as shown in the program below. If you were using PROC IML or another STAT procedure that allowed DO loops, you would have to consult that documentation for more information.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia&lt;BR /&gt;
[pre]&lt;BR /&gt;
data showdo;&lt;BR /&gt;
  do grp='AAA', 'BBB', 'CCC';&lt;BR /&gt;
     do numvar = 1, 3, 5, 7;&lt;BR /&gt;
        do numvar2 = 3, 9;&lt;BR /&gt;
          output;&lt;BR /&gt;
        end;&lt;BR /&gt;
     end;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
                       &lt;BR /&gt;
proc print data=showdo;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 21 Sep 2010 00:31:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73468#M21286</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-09-21T00:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: do loops basic question</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73469#M21287</link>
      <description>Here's some options:&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data mydata;&lt;BR /&gt;
    set mydata;&lt;BR /&gt;
    do i=1,3,5,8,6,13;&lt;BR /&gt;
       *-- do stuff with i here --;&lt;BR /&gt;
       put i=;&lt;BR /&gt;
    end;&lt;BR /&gt;
    *-- yet another option --;&lt;BR /&gt;
    do mm='Dec','Jan','Aug','Feb';  *-- no particular order --;&lt;BR /&gt;
       *-- do stuff with mm here --;&lt;BR /&gt;
       put mm=;&lt;BR /&gt;
    end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
%macro myloop;&lt;BR /&gt;
    %let index = 1 3 6 9 2 7;&lt;BR /&gt;
    %do i=1 %to 6;  %*best to calculate the dimension of index;&lt;BR /&gt;
        %let idx = %scan( &amp;amp;index, &amp;amp;i, %str( ));&lt;BR /&gt;
        %*-- do stuff with &amp;amp;idx here ---;&lt;BR /&gt;
        %put idx=&amp;amp;idx;&lt;BR /&gt;
    %end;&lt;BR /&gt;
%mend;&lt;BR /&gt;
%myloop&lt;BR /&gt;
[/pre]</description>
      <pubDate>Tue, 21 Sep 2010 00:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/do-loops-basic-question/m-p/73469#M21287</guid>
      <dc:creator>WaltSmith</dc:creator>
      <dc:date>2010-09-21T00:32:28Z</dc:date>
    </item>
  </channel>
</rss>

