<?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: %DO %UNTIL loop to a specific month in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208082#M38694</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I ask, what are you trying to do here.&amp;nbsp; Put some test data and required output.&amp;nbsp; I can't see why this is in a macro, or using macro language.&amp;nbsp; There are do loops in datastep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Mar 2015 14:16:28 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2015-03-23T14:16:28Z</dc:date>
    <item>
      <title>%DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208081#M38693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi I want to execute the following loop till 201308, but macro variable are not getting resolved as desired. Kindly advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;%let dater = '20MAR2015'D;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro rtlmn;&lt;BR /&gt;%let i = 0;&lt;BR /&gt;%let monum = 1;&lt;/P&gt;&lt;P&gt;%do %until (input(&amp;amp;monum,8.) = 201308);&lt;BR /&gt;%let i = %eval(&amp;amp;i+1);&lt;BR /&gt;%let datep = %sysfunc(intnx(month,&amp;amp;dater.,-1*&amp;amp;i,b));&amp;nbsp; /*loop to get previous months dates*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;set sashelp.class(obs=1);&lt;BR /&gt;prvmnt&amp;amp;i. = put(&amp;amp;datep.,monyy7.);&lt;BR /&gt;put prvmnt&amp;amp;i.;&lt;BR /&gt;call symput("prvmnt&amp;amp;i.",prvmnt&amp;amp;i.);&amp;nbsp;&amp;nbsp; /*prvmnt1, prvmnt2... will have values FEB2015, JAN2015... */&lt;/P&gt;&lt;P&gt;prev_mon&amp;amp;i. = year(&amp;amp;datep.)*100 + month(&amp;amp;datep.);&lt;BR /&gt;put prev_mon&amp;amp;i.;&lt;BR /&gt;call symput("prmn&amp;amp;i",prev_mon&amp;amp;i.);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*prmn1,prmn2,prmn3.. will have values 201502,201501, 201412 ..*/ &lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let prmn&amp;amp;i. = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.; /*to remove spaces from values*/&lt;BR /&gt;%let monum = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%mend rtlmn;&lt;BR /&gt;%rtlmn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Required operator not found in expression: input(&amp;amp;monum,8.) = 201308&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;ERROR: The condition in the %DO %UNTIL loop, input(&amp;amp;monum,8.) = 201308, yielded an invalid or missing value, .&amp;nbsp; The macro will stop executing.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;ERROR: The macro RTLMN will stop executing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: rajat panda&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 13:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208081#M38693</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T13:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208082#M38694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I ask, what are you trying to do here.&amp;nbsp; Put some test data and required output.&amp;nbsp; I can't see why this is in a macro, or using macro language.&amp;nbsp; There are do loops in datastep?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 14:16:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208082#M38694</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-23T14:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208083#M38695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also have no idea of what your macro is doing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following line requires the %sysfunc() for the inputc or inputn command as appropriate. &lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%do %until (input(&amp;amp;monum,8.) = 201308);&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then other errors pop up...good luck!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 14:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208083#M38695</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-23T14:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208084#M38696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;Thanks fro your reply. I am trying to remove hard codings from below lines.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; sales_month = &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;201308&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; transaction_type_id = &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;905&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; retail &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; end)&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; StarterKits_aug2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This processing goes on till current month.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The modified code will look like -&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;when&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; sales_month = &lt;STRONG style="color: #008080;"&gt;&amp;amp;&amp;amp;prmn&amp;amp;i.&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;and&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; transaction_type_id = &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;905&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; retail &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;STRONG style=": ; color: #008080; font-size: 10pt; font-family: Courier New;"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; end)&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;as&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; StarterKits_&amp;amp;&amp;amp;prvmnt&amp;amp;i.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;Kindly let me know if it can be achieved any other way.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 14:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208084#M38696</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T14:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208085#M38697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, there are several methods of getting there.&amp;nbsp; The way I normally do it is with:&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('data want;');&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i=1 to intck('months','01Aug2013'd,today());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; call execute(' mydate=intnx("month","01aug2013"d,'||put(i,2.)||',"same"); output;');&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call execute('format mydate date9.; run;');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This generates more SAS code based on the loop.&amp;nbsp; If you can provide some test data (in a datastep) and required output can clarify more.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 15:14:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208085#M38697</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-03-23T15:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208086#M38698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks a lot Reeza. The mentioned error is gone. But I am facing another isse..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp; %macro rtlmn;&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp; %let i = 0;&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;&amp;nbsp; %let monum = 1;&lt;/P&gt;&lt;P&gt;4&amp;nbsp;&amp;nbsp;&amp;nbsp; %do %until (%sysfunc(inputn(&amp;amp;monum,8.) = 201408);&lt;/P&gt;&lt;P&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp; %let i = %eval(%bquote(&amp;amp;i)+1);&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;ERROR: Macro keyword LET appears as text.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: A dummy macro will be compiled.&lt;/P&gt;&lt;P&gt;6&amp;nbsp;&amp;nbsp;&amp;nbsp; %let datep = %nrstr(%sysfunc(intnx(month,&amp;amp;dater.,-1*&amp;amp;i,b)));&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;ERROR: Macro keyword LET appears as text.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;7&lt;/P&gt;&lt;P&gt;8&amp;nbsp;&amp;nbsp;&amp;nbsp; data _null_;&lt;/P&gt;&lt;P&gt;9&amp;nbsp;&amp;nbsp;&amp;nbsp; set sashelp.class(obs=1);&lt;/P&gt;&lt;P&gt;10&amp;nbsp;&amp;nbsp; prvmnt&amp;amp;i. = put(&amp;amp;datep.,monyy7.);&lt;/P&gt;&lt;P&gt;11&amp;nbsp;&amp;nbsp; put prvmnt&amp;amp;i.;&lt;/P&gt;&lt;P&gt;12&amp;nbsp;&amp;nbsp; call symput("prvmnt&amp;amp;i.",prvmnt&amp;amp;i.);&lt;/P&gt;&lt;P&gt;13&lt;/P&gt;&lt;P&gt;14&amp;nbsp;&amp;nbsp; prev_mon&amp;amp;i. = year(&amp;amp;datep.)*100 + month(&amp;amp;datep.);&lt;/P&gt;&lt;P&gt;15&amp;nbsp;&amp;nbsp; put prev_mon&amp;amp;i.;&lt;/P&gt;&lt;P&gt;16&amp;nbsp;&amp;nbsp; call symput("prmn&amp;amp;i",prev_mon&amp;amp;i.);&lt;/P&gt;&lt;P&gt;17&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;18&lt;/P&gt;&lt;P&gt;19&amp;nbsp;&amp;nbsp; %let prmn&amp;amp;i. = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.; /*to remove spaces from values*/&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword LET appears as text.&lt;/P&gt;&lt;P&gt;20&amp;nbsp;&amp;nbsp; %let monum = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.;&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword LET appears as text.&lt;/P&gt;&lt;P&gt;21&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword END appears as text.&lt;/P&gt;&lt;P&gt;22&amp;nbsp;&amp;nbsp; %mend rtlmn;&lt;/P&gt;&lt;P&gt;ERROR: Macro keyword MEND appears as text.&lt;/P&gt;&lt;P&gt;23&amp;nbsp;&amp;nbsp; %rtlmn&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to take help from thread- &lt;A _jive_internal="true" href="https://communities.sas.com/message/112741"&gt;https://communities.sas.com/message/112741&lt;/A&gt; but unable to resolve it. Can you please help ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 15:20:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208086#M38698</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T15:20:37Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208087#M38699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi RW9,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply. I am unfamiliar with Call Execute statement. I will look into it's documentation and get back to you. In the meanwhile, I am trying to solve this problem with macro variables. If you can kindly help me resolve the errors for the same, that would be kind of you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 16:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208087#M38699</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T16:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208088#M38700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, if you want help you need to post a full reproducible example. What's the value of your macro variable dater?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT:&lt;/P&gt;&lt;P&gt;Your original macro works fine for me once I set dater and fixed the input function. You need to post your actual code, or possibly restart SAS and see if the error is still present:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; dater="01Jan2014"d;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;STRONG&gt;&lt;EM&gt;rtlmn&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; i = 0;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; monum = 1;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%do&lt;/SPAN&gt; &lt;SPAN style="color: #0433ff;"&gt;%until&lt;/SPAN&gt; (&lt;SPAN style="color: #0433ff;"&gt;%sysfunc&lt;/SPAN&gt;(inputn(&amp;amp;monum,&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;8.&lt;/STRONG&gt;&lt;/SPAN&gt;)) = &lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;201308&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; i = &lt;SPAN style="color: #0433ff;"&gt;%eval&lt;/SPAN&gt;(&amp;amp;i+1);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; datep = &lt;SPAN style="color: #0433ff;"&gt;%sysfunc&lt;/SPAN&gt;(intnx(month,&amp;amp;dater.,-1*&amp;amp;i,b));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;data _null_;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;set sashelp.class(obs=&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;1&lt;/STRONG&gt;&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;prvmnt&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt; = put(&amp;amp;&lt;SPAN style="color: #009193;"&gt;datep.&lt;/SPAN&gt;,&lt;SPAN style="color: #009193;"&gt;monyy7.&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;put prvmnt&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;call symput(&lt;SPAN style="color: #942193;"&gt;"prvmnt&amp;amp;i."&lt;/SPAN&gt;,prvmnt&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;prev_mon&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt; = year(&amp;amp;&lt;SPAN style="color: #009193;"&gt;datep.&lt;/SPAN&gt;)*&lt;SPAN style="color: #009193;"&gt;&lt;STRONG&gt;100&lt;/STRONG&gt;&lt;/SPAN&gt; + month(&amp;amp;&lt;SPAN style="color: #009193;"&gt;datep.&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;put prev_mon&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;call symput(&lt;SPAN style="color: #942193;"&gt;"prmn&amp;amp;i"&lt;/SPAN&gt;,prev_mon&amp;amp;&lt;SPAN style="color: #009193;"&gt;i.&lt;/SPAN&gt;);&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #008f00;"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; prmn&amp;amp;i. = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.; &lt;/SPAN&gt;/*to remove spaces from values*/&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #0433ff;"&gt;%let&lt;/SPAN&gt; monum = &amp;amp;&amp;amp;&amp;amp;prmn&amp;amp;i.;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New'; color: #0433ff;"&gt;%end&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;&lt;SPAN style="color: #011993;"&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;&lt;/SPAN&gt; rtlmn;&lt;/P&gt;&lt;P style="font-size: 10px; font-family: 'Courier New';"&gt;%&lt;STRONG&gt;&lt;EM&gt;rtlmn&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 16:25:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208088#M38700</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-23T16:25:08Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208089#M38701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Reeza. I solved the problem by using %sysfunc() and RESTARTS. Will this code be stable ? Would you like/advice me to use masking operators like %nrstr, %bquote in this code so that it maintains consistency in its functioning ? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 16:49:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208089#M38701</guid>
      <dc:creator>rajat051984</dc:creator>
      <dc:date>2015-03-23T16:49:58Z</dc:date>
    </item>
    <item>
      <title>Re: %DO %UNTIL loop to a specific month</title>
      <link>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208090#M38702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You don't need any masking as far as I can see. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's stable as long as other parts are stable, as mentioned above this isn't a good way to do things but if it works, it works.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2015 17:26:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/DO-UNTIL-loop-to-a-specific-month/m-p/208090#M38702</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-03-23T17:26:42Z</dc:date>
    </item>
  </channel>
</rss>

