<?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: %let 2 months before in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/let-2-months-before/m-p/693066#M211271</link>
    <description>&lt;P&gt;1. %SYSFUNC() is needed on every function (INPUTN and INTNX)&lt;/P&gt;
&lt;P&gt;2. But, %SYSFUNC() also has a second parameter that acts as the format so you don't need the INPUTN actually.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You were referencing start instead of date_start in the third calculation, but I think you really wanted the date_start macro variable that's a SAS date instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or nest all together of course.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1909;/*YYMM*/
%put &amp;amp;start;

%let date_start=%sysfunc(inputn(&amp;amp;start,yymmn4.));
%put &amp;amp;date_start;

%let t=%sysfunc(intnx(month, &amp;amp;date_start, -2, s), yymmn4.);
%put &amp;amp;t;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;User define macro parameter with %let in format of YYMM.&lt;/P&gt;
&lt;P&gt;I know how to create a new macro parameter that is sas date(numeric number that represent number of days since 1.1.1960)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;I want to create a SAS date&amp;nbsp;(number of days since 1.1.1960) of 2 months before &amp;amp;start.&lt;/P&gt;
&lt;P&gt;However it is not working and I receive an error and also the value that I get is null.&lt;/P&gt;
&lt;P&gt;WARNING: Argument 1 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1909;/*YYMM*/
%put &amp;amp;start;
%let date_start=%sysfunc(inputn(&amp;amp;start,yymmn4.));
%put &amp;amp;date_start;&lt;BR /&gt;&lt;BR /&gt;%let t=%sysfunc(inputn(intnx('month',&amp;amp;start,-2),yymmn4.));&lt;BR /&gt;%put &amp;amp;t;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Oct 2020 04:10:19 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-10-21T04:10:19Z</dc:date>
    <item>
      <title>%let 2 months before</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-2-months-before/m-p/693064#M211269</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;User define macro parameter with %let in format of YYMM.&lt;/P&gt;
&lt;P&gt;I know how to create a new macro parameter that is sas date(numeric number that represent number of days since 1.1.1960)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;I want to create a SAS date&amp;nbsp;(number of days since 1.1.1960) of 2 months before &amp;amp;start.&lt;/P&gt;
&lt;P&gt;However it is not working and I receive an error and also the value that I get is null.&lt;/P&gt;
&lt;P&gt;WARNING: Argument 1 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1909;/*YYMM*/
%put &amp;amp;start;
%let date_start=%sysfunc(inputn(&amp;amp;start,yymmn4.));
%put &amp;amp;date_start;&lt;BR /&gt;&lt;BR /&gt;%let t=%sysfunc(inputn(intnx('month',&amp;amp;start,-2),yymmn4.));&lt;BR /&gt;%put &amp;amp;t;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Oct 2020 03:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-2-months-before/m-p/693064#M211269</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2020-10-21T03:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: %let 2 months before</title>
      <link>https://communities.sas.com/t5/SAS-Programming/let-2-months-before/m-p/693066#M211271</link>
      <description>&lt;P&gt;1. %SYSFUNC() is needed on every function (INPUTN and INTNX)&lt;/P&gt;
&lt;P&gt;2. But, %SYSFUNC() also has a second parameter that acts as the format so you don't need the INPUTN actually.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3. You were referencing start instead of date_start in the third calculation, but I think you really wanted the date_start macro variable that's a SAS date instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or nest all together of course.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1909;/*YYMM*/
%put &amp;amp;start;

%let date_start=%sysfunc(inputn(&amp;amp;start,yymmn4.));
%put &amp;amp;date_start;

%let t=%sysfunc(intnx(month, &amp;amp;date_start, -2, s), yymmn4.);
%put &amp;amp;t;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;User define macro parameter with %let in format of YYMM.&lt;/P&gt;
&lt;P&gt;I know how to create a new macro parameter that is sas date(numeric number that represent number of days since 1.1.1960)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question:&lt;/P&gt;
&lt;P&gt;I want to create a SAS date&amp;nbsp;(number of days since 1.1.1960) of 2 months before &amp;amp;start.&lt;/P&gt;
&lt;P&gt;However it is not working and I receive an error and also the value that I get is null.&lt;/P&gt;
&lt;P&gt;WARNING: Argument 1 to function INPUTN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let start=1909;/*YYMM*/
%put &amp;amp;start;
%let date_start=%sysfunc(inputn(&amp;amp;start,yymmn4.));
%put &amp;amp;date_start;&lt;BR /&gt;&lt;BR /&gt;%let t=%sysfunc(inputn(intnx('month',&amp;amp;start,-2),yymmn4.));&lt;BR /&gt;%put &amp;amp;t;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Oct 2020 04:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/let-2-months-before/m-p/693066#M211271</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-10-21T04:10:19Z</dc:date>
    </item>
  </channel>
</rss>

