<?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 Automatically filling out control table with numeric values for loop-job (user written code) in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114180#M1328</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created a loop-job which runs the inner job once per month, from the previous month and back until october 2011. The job is parameterized so that -1 indicates one month back, -2 indicates two months back, etc. The control table currently contains the variable "month_back" with values from 1- to -13, so that the inner job is run from oct2012 to oct 2011.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the values in the control table are static, so each month I have to manually add another number so that it goes all the way back to oct2011.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is user written code that creates a table where month_back is automatically filled out with all the proper values according to the current month. If I run it today it should get values from -1 to -13, if I run it next month it should get values from -1 to -14, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd appreciate any advice on how to accomplish this. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic start:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;data work.months_back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let startdate = %sysfunc(intnx(month, %sysfunc(date()), -1, E), date9.); *appears as 31OCT2012 if run in November;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month_back = -1 *one month back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *must get values for all months back until october 2011;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;run;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;data &amp;amp;_output;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set months_back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Nov 2012 11:14:30 GMT</pubDate>
    <dc:creator>TurnTheBacon</dc:creator>
    <dc:date>2012-11-01T11:14:30Z</dc:date>
    <item>
      <title>Automatically filling out control table with numeric values for loop-job (user written code)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114180#M1328</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've created a loop-job which runs the inner job once per month, from the previous month and back until october 2011. The job is parameterized so that -1 indicates one month back, -2 indicates two months back, etc. The control table currently contains the variable "month_back" with values from 1- to -13, so that the inner job is run from oct2012 to oct 2011.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is that the values in the control table are static, so each month I have to manually add another number so that it goes all the way back to oct2011.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I need is user written code that creates a table where month_back is automatically filled out with all the proper values according to the current month. If I run it today it should get values from -1 to -13, if I run it next month it should get values from -1 to -14, etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd appreciate any advice on how to accomplish this. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Basic start:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;data work.months_back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let startdate = %sysfunc(intnx(month, %sysfunc(date()), -1, E), date9.); *appears as 31OCT2012 if run in November;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; month_back = -1 *one month back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *must get values for all months back until october 2011;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;run;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;data &amp;amp;_output;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set months_back;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 11:14:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114180#M1328</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2012-11-01T11:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically filling out control table with numeric values for loop-job (user written code)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114181#M1329</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think this is what you are looking for.&amp;nbsp; Day of month in these dates does not matter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%Let initmonth = '01OCT2011'D ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data control ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thismonth = date() ; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Intervals = 1 + intck ('MONTH', &amp;amp;initmonth, thismonth) ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Put intervals= ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Do month_back = -1 to -intervals by -1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Output ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Keep month_back ;&lt;/P&gt;&lt;P&gt;Run ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard in Oz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 11:43:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114181#M1329</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-11-01T11:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Automatically filling out control table with numeric values for loop-job (user written code)</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114182#M1330</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brilliant, thanks. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Nov 2012 12:14:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Automatically-filling-out-control-table-with-numeric-values-for/m-p/114182#M1330</guid>
      <dc:creator>TurnTheBacon</dc:creator>
      <dc:date>2012-11-01T12:14:48Z</dc:date>
    </item>
  </channel>
</rss>

