<?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 Loop Over Values in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568740#M11713</link>
    <description>&lt;P&gt;A more specific answer depends on the structure of the "other data set".&amp;nbsp; Does it contain one observation with a set of variables to feed the macro?&amp;nbsp; Does it contain a set of observations, each with one value to feed to the macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, add a closing quote when you use&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;call &lt;SPAN class="token keyword"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'%nrstr(%pleasehelp('&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; string &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; '&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 25 Jun 2019 13:18:53 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2019-06-25T13:18:53Z</dc:date>
    <item>
      <title>Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568687#M11704</link>
      <description>&lt;P&gt;Sorry for posting this as I have looked at similar questions but cannot quite understand the method.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have created a simple query and put this into a macro that I now intend to loop through using a list of values from a variable held in another data set as part of the filter.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro pleasehelp(myvalue) lets say myvalue is what will change in each loop through.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myvalue is a list of values stored in another data set.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to be able to do ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; &lt;STRONG&gt;&lt;I&gt;my_loop&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%do&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; i=myvalue1 &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%to&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; myvalue6;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%&lt;STRONG&gt;&lt;I&gt;pleasehelp&lt;/I&gt;&lt;/STRONG&gt;(&amp;amp;i);&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%end&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="3"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; my_loop;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;hope that makes sense and greatly appreciative of responses!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 10:34:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568687#M11704</guid>
      <dc:creator>mauley</dc:creator>
      <dc:date>2019-06-25T10:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568692#M11706</link>
      <description>&lt;P&gt;Use call execute from a pseudo dataset:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
input string $;
call execute('%nrstr(%pleasehelp(' !! string !! ')););
datalines;
myvalue1
myvalue2
myvalue3
myvalue4
myvalue5
myvalue6
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 10:55:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568692#M11706</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-25T10:55:38Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568701#M11707</link>
      <description>&lt;P&gt;thanks - what if my list of values was much greater than 6 and I wanted the solution to be dynamic so I didn't need to enter data lines?&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 11:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568701#M11707</guid>
      <dc:creator>mauley</dc:creator>
      <dc:date>2019-06-25T11:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568705#M11709</link>
      <description>&lt;P&gt;That many data items will surely be kept in a dataset, so it's the same method. Just use that dataset instead of the datalines.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 11:23:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568705#M11709</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-06-25T11:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568740#M11713</link>
      <description>&lt;P&gt;A more specific answer depends on the structure of the "other data set".&amp;nbsp; Does it contain one observation with a set of variables to feed the macro?&amp;nbsp; Does it contain a set of observations, each with one value to feed to the macro?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note, add a closing quote when you use&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;'s solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;call &lt;SPAN class="token keyword"&gt;execute&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'%nrstr(%pleasehelp('&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; string &lt;SPAN class="token operator"&gt;!!&lt;/SPAN&gt; '&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;STRONG&gt;'&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 13:18:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568740#M11713</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-25T13:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568745#M11714</link>
      <description>&lt;P&gt;it is multiple obs with each obs to be fed through the macro &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2019 13:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568745#M11714</guid>
      <dc:creator>mauley</dc:creator>
      <dc:date>2019-06-25T13:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: Do Loop Over Values</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568749#M11715</link>
      <description>&lt;P&gt;So when&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;says to use that data set instead of datalines, here's what that means:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set other_dataset;;
call execute('%nrstr(%pleasehelp(' !! variable_from_other_dataset !! '));');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2019 13:28:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Do-Loop-Over-Values/m-p/568749#M11715</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-06-25T13:28:16Z</dc:date>
    </item>
  </channel>
</rss>

