<?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: Loop thru values in a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Loop-thru-values-in-a-data-set/m-p/278147#M55939</link>
    <description>&lt;P&gt;Typically, this is done via a call execute() in a data _null_ step.&lt;/P&gt;
&lt;P&gt;But what kind of pull do you need to do?&lt;/P&gt;
&lt;P&gt;Perhaps it could be solved in a simple SQL join?&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jun 2016 10:45:01 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-06-17T10:45:01Z</dc:date>
    <item>
      <title>Loop thru values in a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-thru-values-in-a-data-set/m-p/277958#M55879</link>
      <description>&lt;P&gt;I am an experienced developer in everything but SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Dataset ---&amp;gt;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;"Periods"&lt;/STRONG&gt; with a single column and 12 periods:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;YYYYPP&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;201605&lt;/P&gt;&lt;P&gt;201604&lt;/P&gt;&lt;P&gt;201603&lt;/P&gt;&lt;P&gt;201602&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want step thru each data format in the Periods table, run an query to pull based on each of the 12 dates,&amp;nbsp;by setting the current period equal to a variable and using the variable as criteria for the pull.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can do all parts of this except the looping part of the code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is my approach and I can't get it to work.&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;macro1&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;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%Do&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt; i = &lt;/FONT&gt;&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%To&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;12&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;%By&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;1&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;call&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; symputx (&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'YYYYPP'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;,trim(YYYYPP));&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;RunQuery using &amp;amp;YYYYPP.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;%end&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; macro1; %&lt;STRONG&gt;&lt;I&gt;macro1&lt;/I&gt;&lt;/STRONG&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;Any Help is appreciated in advance.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Jun 2016 16:24:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-thru-values-in-a-data-set/m-p/277958#M55879</guid>
      <dc:creator>Kody_devl</dc:creator>
      <dc:date>2016-06-16T16:24:08Z</dc:date>
    </item>
    <item>
      <title>Re: Loop thru values in a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Loop-thru-values-in-a-data-set/m-p/278147#M55939</link>
      <description>&lt;P&gt;Typically, this is done via a call execute() in a data _null_ step.&lt;/P&gt;
&lt;P&gt;But what kind of pull do you need to do?&lt;/P&gt;
&lt;P&gt;Perhaps it could be solved in a simple SQL join?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jun 2016 10:45:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Loop-thru-values-in-a-data-set/m-p/278147#M55939</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-17T10:45:01Z</dc:date>
    </item>
  </channel>
</rss>

