<?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: intnx is not giving the actual date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366434#M87170</link>
    <description>&lt;P&gt;I think you have commented out your set statement as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* set ODMSCDS.FIELD;*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and you are trying to compare datetime values with dates, which will fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just to avoid confusion when reading code, do not name a SAS dataset null &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Jun 2017 08:34:24 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2017-06-13T08:34:24Z</dc:date>
    <item>
      <title>intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366424#M87163</link>
      <description>&lt;P&gt;Hi SAS Expertise,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(intnx(year,%sysfunc(today()),1),date9.);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Based on the online guide from google, it should return the date 13th Jun 2018 as i want to get 1 year increment from today.&lt;/P&gt;&lt;P&gt;However, I am only getting 1st Jan 2018. May i know which part is wrong/missing from the code above?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:05:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366424#M87163</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2017-06-13T08:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366425#M87164</link>
      <description>&lt;P&gt;Use 'sameday' as the alignment option&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
	format var date9.;
	var = intnx('year',today(),1,'sameday');
	put var;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Consulting the documentation, the default value of the alignment option is ''beginning". Allowed values are BEGINNING, MIDDLE, END, and SAMEDAY.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_tsdata_sect038.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_tsdata_sect038.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366425#M87164</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-13T08:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366430#M87166</link>
      <description>&lt;P&gt;Depending on the further use of the value, I'd even do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nextdate=%sysfunc(intnx(year,%sysfunc(today()),1,s),best.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which allows the direct use of &amp;amp;nextdate in any date operation/comparison (no quotes and trailing d needed).&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366430#M87166</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-13T08:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366433#M87169</link>
      <description>Hi, i tried 's' but i got error until i saw your reply without the single quotation, it works! However, when i put it in SAS DI Studio, i got this error :&lt;BR /&gt;data null;&lt;BR /&gt;27 /* set ODMSCDS.FIELD;*/&lt;BR /&gt;28 where '2017-01-01 00:00:00'dt &amp;gt;= %sysfunc(intnx(year,%sysfunc(today()),-2,s),date9.);&lt;BR /&gt;NOTE: Line generated by the macro function "SYSFUNC".&lt;BR /&gt;28 13JUN2015&lt;BR /&gt;_______&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;BR /&gt;ERROR: No input data sets available for WHERE statement.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, AND, EQ, GE, GT, LE, LT,&lt;BR /&gt;NE, OR, ^=, |, ||, ~=.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;29 run;</description>
      <pubDate>Tue, 13 Jun 2017 08:25:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366433#M87169</guid>
      <dc:creator>imdickson</dc:creator>
      <dc:date>2017-06-13T08:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366434#M87170</link>
      <description>&lt;P&gt;I think you have commented out your set statement as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* set ODMSCDS.FIELD;*/&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and you are trying to compare datetime values with dates, which will fail.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And just to avoid confusion when reading code, do not name a SAS dataset null &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:34:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366434#M87170</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2017-06-13T08:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: intnx is not giving the actual date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366435#M87171</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/63520"&gt;@imdickson&lt;/a&gt; wrote:&lt;BR /&gt;Hi, i tried 's' but i got error until i saw your reply without the single quotation, it works! However, when i put it in SAS DI Studio, i got this error :&lt;BR /&gt;data null;&lt;BR /&gt;27 /* set ODMSCDS.FIELD;*/&lt;BR /&gt;28 where '2017-01-01 00:00:00'dt &amp;gt;= %sysfunc(intnx(year,%sysfunc(today()),-2,s),date9.);&lt;BR /&gt;NOTE: Line generated by the macro function "SYSFUNC".&lt;BR /&gt;28 13JUN2015&lt;BR /&gt;_______&lt;BR /&gt;22&lt;BR /&gt;76&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;BR /&gt;ERROR: No input data sets available for WHERE statement.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: !, !!, &amp;amp;, *, **, +, -, /, &amp;lt;, &amp;lt;=, &amp;lt;&amp;gt;, =, &amp;gt;, &amp;gt;=, AND, EQ, GE, GT, LE, LT,&lt;BR /&gt;NE, OR, ^=, |, ||, ~=.&lt;BR /&gt;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;&lt;BR /&gt;29 run;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's why I gave you the hint with using the best. format to obtain the raw date value, which can easily be used in such situations;&lt;/P&gt;
&lt;P&gt;but you have an apple/orange problem, because you compare a datetime literal with a date value, which will surely fail. And the datetime literal was not correctly written (datetime literals also use the SAS date. format)!&lt;/P&gt;
&lt;P&gt;Use&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where '01jan2017'd &amp;gt;= %sysfunc(intnx(year,%sysfunc(today()),-2,s),best.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;PS after rethinking it, I'm wondering what you try to accomplish. Depending on today's date, you'd either get all observations from the dataset or none, as you are in fact comparing two literals.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 08:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-is-not-giving-the-actual-date/m-p/366435#M87171</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-13T08:56:13Z</dc:date>
    </item>
  </channel>
</rss>

