<?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 Loop over list of characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101517#M21265</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For looping over a list of characters, a data null step works fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; do r="AB", "DE", "XY";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put r=;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm curious if this be replicated in a macro?&amp;nbsp; When I try with the code below, it expects a %to to be paired with the %do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro char_loop;&lt;/P&gt;&lt;P&gt; %do r="AB", "DE", "XY";&lt;BR /&gt;&amp;nbsp; %put &amp;amp;r=;&lt;BR /&gt; %end;&lt;/P&gt;&lt;P&gt;%mend char_loop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone interested, there were a couple threads that touch on this topic:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/42866#42866"&gt;https://communities.sas.com/message/42866#42866&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/120110#120110"&gt;https://communities.sas.com/message/120110#120110&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Apr 2013 20:01:04 GMT</pubDate>
    <dc:creator>jaredp</dc:creator>
    <dc:date>2013-04-08T20:01:04Z</dc:date>
    <item>
      <title>Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101517#M21265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For looping over a list of characters, a data null step works fine:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt; do r="AB", "DE", "XY";&lt;/P&gt;&lt;P&gt;&amp;nbsp; put r=;&lt;/P&gt;&lt;P&gt; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I'm curious if this be replicated in a macro?&amp;nbsp; When I try with the code below, it expects a %to to be paired with the %do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro char_loop;&lt;/P&gt;&lt;P&gt; %do r="AB", "DE", "XY";&lt;BR /&gt;&amp;nbsp; %put &amp;amp;r=;&lt;BR /&gt; %end;&lt;/P&gt;&lt;P&gt;%mend char_loop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For anyone interested, there were a couple threads that touch on this topic:&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/42866#42866"&gt;https://communities.sas.com/message/42866#42866&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/120110#120110"&gt;https://communities.sas.com/message/120110#120110&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:01:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101517#M21265</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-04-08T20:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101518#M21266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%DO loop is not as nearly robust as its datastep counterpart. No, I don't think you can use the same style of looping.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:32:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101518#M21266</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-04-08T20:32:00Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101519#M21267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been coming to the same conclusion.&amp;nbsp; If it a macro countapart is possible (and it likely is), the code would likely be painful.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 20:37:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101519#M21267</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-04-08T20:37:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101520#M21268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Scan through a list..as mentioned in your links.&lt;/P&gt;&lt;P&gt;And bump it up on the ideas list or SASware ballot as well &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;A _jive_internal="true" href="https://communities.sas.com/ideas/1084" title="https://communities.sas.com/ideas/1084"&gt;https://communities.sas.com/ideas/1084&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let i=1;&lt;/P&gt;&lt;P&gt;%do %while (%scan(&amp;amp;varlist, &amp;amp;i, " ") ^=%str());&lt;/P&gt;&lt;P&gt;%let var=%scan(&amp;amp;varlist, &amp;amp;i, " ");&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let i=%eval(&amp;amp;i+1);&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 21:16:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101520#M21268</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-04-08T21:16:30Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101521#M21269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza.&amp;nbsp; Good idea to add this to the ballot. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did see that macro solution, but it certainly is not pretty.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 14:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101521#M21269</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-04-09T14:10:04Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101522#M21270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Haha, I see I already had my vote added to that idea.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 14:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101522#M21270</guid>
      <dc:creator>jaredp</dc:creator>
      <dc:date>2013-04-09T14:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Loop over list of characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101523#M21271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This trick is shown in&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables" title="http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables"&gt;http://www.sascommunity.org/wiki/List_Processing_Basics_Creating_and_Using_Lists_of_Macro_Variables&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2013 16:03:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-over-list-of-characters/m-p/101523#M21271</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2013-04-09T16:03:35Z</dc:date>
    </item>
  </channel>
</rss>

