<?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: Updating Macro Variable with Macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343085#M78722</link>
    <description>&lt;P&gt;Don't know without seeing the rest of the code you run, but one possibility would be to wrap everything in a macro. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro doit (first,last)
  %do cyear=&amp;amp;first %to &amp;amp;last;  /* YEAR OF COHORT */
    %let CYEAR2 = %eval(&amp;amp;CYEAR. + 1);
    %let TERM = &amp;amp;CYEAR.FA; /* TERM OF COHORT */
    %let NTERM = &amp;amp;CYEAR2.SP; /* +1 TERM TO CHECK 1 TERM RETENTION STATUS */
    %let NYTERM = &amp;amp;CYEAR2.FA; /* +1 YEAR TO CHECK 1 YEAR RETENTION STATUS */

%include your_actual_program.sas;
%mend doit;

%doit (2010,2016)
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
    <pubDate>Tue, 21 Mar 2017 21:45:27 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-03-21T21:45:27Z</dc:date>
    <item>
      <title>Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343081#M78719</link>
      <description>&lt;P&gt;I have several programs that I run for several different years to generation reports.&amp;nbsp; Currently, I have to manually change the %let CYEAR each time I run the program, and I run it for 2010 - 2016. Is there a way for it to run 1 time for all the years I want to run?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let CYEAR = 2010;  /* YEAR OF COHORT */
%let CYEAR2 = %eval(&amp;amp;CYEAR. + 1);
%let TERM = &amp;amp;CYEAR.FA; /* TERM OF COHORT */
%let NTERM = &amp;amp;CYEAR2.SP; /* +1 TERM TO CHECK 1 TERM RETENTION STATUS */
%let NYTERM = &amp;amp;CYEAR2.FA; /* +1 YEAR TO CHECK 1 YEAR RETENTION STATUS */&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343081#M78719</guid>
      <dc:creator>laura6728</dc:creator>
      <dc:date>2017-03-21T21:37:57Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343083#M78720</link>
      <description>&lt;P&gt;Within a macro, you can do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do cyear = 2010 %to 2016;
/* your code */
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343083#M78720</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-21T21:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343085#M78722</link>
      <description>&lt;P&gt;Don't know without seeing the rest of the code you run, but one possibility would be to wrap everything in a macro. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro doit (first,last)
  %do cyear=&amp;amp;first %to &amp;amp;last;  /* YEAR OF COHORT */
    %let CYEAR2 = %eval(&amp;amp;CYEAR. + 1);
    %let TERM = &amp;amp;CYEAR.FA; /* TERM OF COHORT */
    %let NTERM = &amp;amp;CYEAR2.SP; /* +1 TERM TO CHECK 1 TERM RETENTION STATUS */
    %let NYTERM = &amp;amp;CYEAR2.FA; /* +1 YEAR TO CHECK 1 YEAR RETENTION STATUS */

%include your_actual_program.sas;
%mend doit;

%doit (2010,2016)
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 21:45:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343085#M78722</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-21T21:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343097#M78729</link>
      <description>&lt;P&gt;Or use CALL EXECUTE to loop and call the macro 6 times, there are lots of ways to automate a macro loop.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Mar 2017 22:14:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343097#M78729</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-21T22:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343262#M78799</link>
      <description>&lt;P&gt;I am sorry everyone, I posted this in the BASE forum and I am using EG. I am going to move this over to the EG board. Sorry, and thanks for the help!&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 13:24:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343262#M78799</guid>
      <dc:creator>laura6728</dc:creator>
      <dc:date>2017-03-22T13:24:17Z</dc:date>
    </item>
    <item>
      <title>Re: Updating Macro Variable with Macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343266#M78800</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32615"&gt;@laura6728&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I am sorry everyone, I posted this in the BASE forum and I am using EG. I am going to move this over to the EG board. Sorry, and thanks for the help!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not necessary. It's got more to do with Base SAS code than with EG functionality.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 13:41:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Updating-Macro-Variable-with-Macro/m-p/343266#M78800</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-03-22T13:41:38Z</dc:date>
    </item>
  </channel>
</rss>

