<?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 Autoincremented numeric variable throughout months in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Autoincremented-numeric-variable-throughout-months/m-p/611366#M18185</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to increment a value from the number 13.&lt;/P&gt;&lt;P&gt;In my case, the number 13 means "September2017".&lt;/P&gt;&lt;P&gt;I want to increment this number by 1 for each additional month (14 for October2017, 15 for November2017, 16 for December2017, 17 for January2018 and so on...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I want the number 14, I tried the following code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Initial_Month='01SEP2017'd; /*Fixed value*/
%let Day=%sysfunc(intnx(month, %sysfunc(today()), -1), DATE9.);
%let Actual_Month= 13 + %sysfunc(intck('month', &amp;amp;Initial_Month. , &amp;amp;Day.));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I got the following error :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR: Argument 3 to function INTCK referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;BR /&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC&lt;BR /&gt;or %QSYSFUNC function reference is terminated.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm also opened to solutions using Data steps, the point is just to get a macro variable with an autoincremental value 14.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
    <pubDate>Thu, 12 Dec 2019 15:43:38 GMT</pubDate>
    <dc:creator>Mick_lb</dc:creator>
    <dc:date>2019-12-12T15:43:38Z</dc:date>
    <item>
      <title>Autoincremented numeric variable throughout months</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Autoincremented-numeric-variable-throughout-months/m-p/611366#M18185</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to increment a value from the number 13.&lt;/P&gt;&lt;P&gt;In my case, the number 13 means "September2017".&lt;/P&gt;&lt;P&gt;I want to increment this number by 1 for each additional month (14 for October2017, 15 for November2017, 16 for December2017, 17 for January2018 and so on...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, if I want the number 14, I tried the following code :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Initial_Month='01SEP2017'd; /*Fixed value*/
%let Day=%sysfunc(intnx(month, %sysfunc(today()), -1), DATE9.);
%let Actual_Month= 13 + %sysfunc(intck('month', &amp;amp;Initial_Month. , &amp;amp;Day.));&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But I got the following error :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;ERROR: Argument 3 to function INTCK referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number.&lt;BR /&gt;ERROR: Invalid arguments detected in %SYSCALL, %SYSFUNC, or %QSYSFUNC argument list. Execution of %SYSCALL statement or %SYSFUNC&lt;BR /&gt;or %QSYSFUNC function reference is terminated.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm also opened to solutions using Data steps, the point is just to get a macro variable with an autoincremental value 14.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for your help !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 15:43:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Autoincremented-numeric-variable-throughout-months/m-p/611366#M18185</guid>
      <dc:creator>Mick_lb</dc:creator>
      <dc:date>2019-12-12T15:43:38Z</dc:date>
    </item>
    <item>
      <title>Re: Autoincremented numeric variable throughout months</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Autoincremented-numeric-variable-throughout-months/m-p/611367#M18186</link>
      <description>&lt;P&gt;A common mistake is that you have formatted a macro variable into a human-readable date. DO NOT FORMAT MACRO VARIABLE VALUES into human-readable values (unless you are using these dates in titles or labels).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let Initial_Month='01SEP2017'd; 
%let Day=%sysfunc(intnx(month, %sysfunc(today()),-1)); /* I removed the format here */
%let Actual_Month= %eval(13 + %sysfunc(intck(month, &amp;amp;Initial_Month. , &amp;amp;Day.))); 
%put &amp;amp;=actual_month;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This works because now DAY is an integer representing the number of days since Jan 1 1960; which is how SAS needs to have date values represented. Since I ran this on 12/12/19, the value of &amp;amp;DAY is 21854. This works properly in INTCK. If &amp;amp;DAY is 01NOV2019 (as you would have in your original code), this is not a valid third argument of INTCK.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Dec 2019 15:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Autoincremented-numeric-variable-throughout-months/m-p/611367#M18186</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-12-12T15:56:10Z</dc:date>
    </item>
  </channel>
</rss>

