<?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 Automating Date macro variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28809#M5360</link>
    <description>Does anyone have any thoughts on how I might be able to automate the below list of macro variables. Mth1 changes every month and the format of the mth varaibles need to the same yymm-1004, 1005 etc. I would greatly appreciate any ideas.&lt;BR /&gt;
&lt;BR /&gt;
rsubmit;&lt;BR /&gt;
%let mth1  	= 1004;&lt;BR /&gt;
%let mth2  	= 1003;&lt;BR /&gt;
%let mth3  	= 1002;&lt;BR /&gt;
%let mth4  	= 1001;&lt;BR /&gt;
%let mth5 	= 0912;&lt;BR /&gt;
%let mth6  	= 0911;&lt;BR /&gt;
%let mth7 	= 0910;&lt;BR /&gt;
%let mth8  	= 0909;&lt;BR /&gt;
%let mth9  	= 0908;&lt;BR /&gt;
%let mth10  = 0907;&lt;BR /&gt;
%let mth11  = 0906;&lt;BR /&gt;
%let mth12  = 0905;&lt;BR /&gt;
endrsubmit;</description>
    <pubDate>Fri, 28 May 2010 16:33:46 GMT</pubDate>
    <dc:creator>SAS09</dc:creator>
    <dc:date>2010-05-28T16:33:46Z</dc:date>
    <item>
      <title>Automating Date macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28809#M5360</link>
      <description>Does anyone have any thoughts on how I might be able to automate the below list of macro variables. Mth1 changes every month and the format of the mth varaibles need to the same yymm-1004, 1005 etc. I would greatly appreciate any ideas.&lt;BR /&gt;
&lt;BR /&gt;
rsubmit;&lt;BR /&gt;
%let mth1  	= 1004;&lt;BR /&gt;
%let mth2  	= 1003;&lt;BR /&gt;
%let mth3  	= 1002;&lt;BR /&gt;
%let mth4  	= 1001;&lt;BR /&gt;
%let mth5 	= 0912;&lt;BR /&gt;
%let mth6  	= 0911;&lt;BR /&gt;
%let mth7 	= 0910;&lt;BR /&gt;
%let mth8  	= 0909;&lt;BR /&gt;
%let mth9  	= 0908;&lt;BR /&gt;
%let mth10  = 0907;&lt;BR /&gt;
%let mth11  = 0906;&lt;BR /&gt;
%let mth12  = 0905;&lt;BR /&gt;
endrsubmit;</description>
      <pubDate>Fri, 28 May 2010 16:33:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28809#M5360</guid>
      <dc:creator>SAS09</dc:creator>
      <dc:date>2010-05-28T16:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Date macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28810#M5361</link>
      <description>Hi:&lt;BR /&gt;
  There are a couple of different ways that you could do this. You could do this in a DATA step program and create the macro variables with CALL SYMPUT or you could do this in a Macro program and use %SYSFUNC. In either case, you'd have to use INTNX to move the dates backward in time.&lt;BR /&gt;
&lt;BR /&gt;
  My inclination would be to use CALL SYMPUT inside a DATA step program and then wrap the DATA step program in a Macro program so that the start month, year and number of months could all be provided as parameters to the macro program.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 28 May 2010 19:46:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28810#M5361</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-28T19:46:36Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Date macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28811#M5362</link>
      <description>rsubmit ;&lt;BR /&gt;
%let mth1=1apr2010 ;&lt;BR /&gt;
data _null_ ;&lt;BR /&gt;
do d= 1 to 12  ;&lt;BR /&gt;
   date = intnx( 'month', "&amp;amp;mth1"d, 1-d) ;&lt;BR /&gt;
   mnth = put( date, yymmN4. ) ;&lt;BR /&gt;
   call symputx( 'mth' !! put( d, 2.-L), mnth ) ;&lt;BR /&gt;
end;&lt;BR /&gt;
stop ;&lt;BR /&gt;
run;&lt;BR /&gt;
endrsubmit ;</description>
      <pubDate>Fri, 28 May 2010 21:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28811#M5362</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-05-28T21:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Date macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28812#M5363</link>
      <description>Thanks, Peter! And thanks for remembering the SYMPUTX.&lt;BR /&gt;
cynthia</description>
      <pubDate>Fri, 28 May 2010 21:31:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28812#M5363</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-28T21:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Automating Date macro variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28813#M5364</link>
      <description>Thank you Cynthia and Peter! It worked!!</description>
      <pubDate>Mon, 31 May 2010 21:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Automating-Date-macro-variables/m-p/28813#M5364</guid>
      <dc:creator>SAS09</dc:creator>
      <dc:date>2010-05-31T21:30:53Z</dc:date>
    </item>
  </channel>
</rss>

