<?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: macro variable in set statements based on today() in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320825#M70718</link>
    <description>&lt;P&gt;I don't know what you mean by 'between'. &amp;nbsp;I've never seen that. &amp;nbsp;I'm not familiar wiith indsname either, when I run that I get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does not contain any members&lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2016 21:42:44 GMT</pubDate>
    <dc:creator>Steelers_In_DC</dc:creator>
    <dc:date>2016-12-22T21:42:44Z</dc:date>
    <item>
      <title>macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320809#M70711</link>
      <description>&lt;P&gt;I am trying to join a years worth of tables together while adding a field 'Reprting_Month'. &amp;nbsp;What I have isn't working, I'm hoping it'll make enough sense to get the point accross. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I have;&lt;/P&gt;
&lt;P&gt;consumer201611&lt;/P&gt;
&lt;P&gt;field1 field1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;consumer201610&lt;/P&gt;
&lt;P&gt;field1 field1&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consumer_Agg&lt;/P&gt;
&lt;P&gt;201611 field1 field2&lt;/P&gt;
&lt;P&gt;201610 field1 field2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I've tried so far is somethig like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data consumer_agg;&lt;/P&gt;
&lt;P&gt;%macro dates;&lt;/P&gt;
&lt;P&gt;set&lt;/P&gt;
&lt;P&gt;%do date = 201511 %to 201611;&lt;/P&gt;
&lt;P&gt;fdr.consumer&amp;amp;dates;&lt;/P&gt;
&lt;P&gt;%end;&lt;/P&gt;
&lt;P&gt;%mend;&lt;/P&gt;
&lt;P&gt;end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the code runs with no errors but has no output. &amp;nbsp;I know I've done this in the past but can't find my old code. &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 20:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320809#M70711</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2016-12-22T20:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320811#M70712</link>
      <description>&lt;P&gt;Have you tried the short cut methods instead of listing all (colon and/or - between first and last datasets)?&lt;/P&gt;
&lt;P&gt;Or extracting all the names from SASHELP.VTABLE?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 20:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320811#M70712</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-22T20:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320812#M70713</link>
      <description>&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set consumer2016: indsname=source;&lt;/P&gt;
&lt;P&gt;dset_month = source;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 20:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320812#M70713</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-22T20:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320813#M70714</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;
&lt;PRE&gt;%macro dates;
%do date = 201511 %to 201611;
fdr.consumer&amp;amp;dates
%end;
%mend;

data consumer_agg;

set
%dates
;
end;&lt;/PRE&gt;
&lt;P&gt;3 problems: 1) you never called the macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) by putting ; after the fdr.consumer&amp;amp;dates value you would have terminated the set statement with the first name.&lt;/P&gt;
&lt;P&gt;3) The data step ended on encountering the %macro statement as that is one of the boundaries between procedures. I suspect you got some odd message in the log about a data set with 0 variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use&lt;/P&gt;
&lt;P&gt;Options mprint symbolgen;&lt;/P&gt;
&lt;P&gt;to see the code that is generated by your actual macro code.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 20:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320813#M70714</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-12-22T20:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320825#M70718</link>
      <description>&lt;P&gt;I don't know what you mean by 'between'. &amp;nbsp;I've never seen that. &amp;nbsp;I'm not familiar wiith indsname either, when I run that I get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does not contain any members&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 21:42:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320825#M70718</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2016-12-22T21:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable in set statements based on today()</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320826#M70719</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30712"&gt;@Steelers_In_DC&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I don't know what you mean by 'between'. &amp;nbsp;I've never seen that. &amp;nbsp;I'm not familiar wiith indsname either, when I run that I get:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;does not contain any members&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;INDSNAME is an option that creates a variable that can store the name of the dataset a record comes from, when appending multiple datasets together.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Post your log. As long as you're on SAS 9.3+ this should work, if you're on 9.2 then it won't.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2016 21:47:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable-in-set-statements-based-on-today/m-p/320826#M70719</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-12-22T21:47:32Z</dc:date>
    </item>
  </channel>
</rss>

