<?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 function-Why get null value in result?? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549038#M152298</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To your why-&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"Hello&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I am trying to use&amp;nbsp;INTNX function to get one day after&amp;nbsp; date in&amp;nbsp;start column.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Why am I getting null value ?(In following statement:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;OneDay_after_start&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;INTNX&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&amp;nbsp;start&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;Move your&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;OneDay_after_start=INTNX ('day', start, 1);&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;Before&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;if eof then output;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;See the below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tbl2;
set tbl1 end=eof;
OneDay_after_start=INTNX ('day', start, 1);
if eof then output;
/*OneDay_after_start=INTNX ('day', start, 1);*/
call symput('xxx1',start);
call symput('xxx2',put(start,date9.));
call symput('xxx3',"'"||put(start,date9.)||"'d");

call symput('www1',OneDay_after_start);
call symput('www2',put(OneDay_after_start,date9.));
call symput('www3',"'"||put(OneDay_after_start,date9.)||"'d");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 06 Apr 2019 13:09:36 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-04-06T13:09:36Z</dc:date>
    <item>
      <title>INTNX function-Why get null value in result??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549034#M152295</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I am trying to use&amp;nbsp;INTNX function to get one day after&amp;nbsp; date in&amp;nbsp;start column.&lt;/P&gt;
&lt;P&gt;Why am I getting null value ?(In following statement:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;OneDay_after_start=INTNX ('day', start, 1);&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data tbl1;
informat start date9. end date9.;
format start date9. end date9.;
input mon start end;
cards;
1812 '21DEC2018'd '21Jan2019'd
1901 '22Jan2019'd '21Feb2019'd
1902 '22Feb2019'd '21Mar2019'd
;
run;


data tbl2;
set tbl1 end=eof;
if eof then output;
OneDay_after_start=INTNX ('day', start, 1);
call symput('xxx1',start);
call symput('xxx2',put(start,date9.));
call symput('xxx3',"'"||put(start,date9.)||"'d");

call symput('www1',OneDay_after_start);
call symput('www2',put(OneDay_after_start,date9.));
call symput('www3',"'"||put(OneDay_after_start,date9.)||"'d");
run;
%put &amp;amp;xxx1.;/*21602*/
%put &amp;amp;xxx2.;/*22FEB2019*/
%put &amp;amp;xxx3.;/*'22FEB2019'dt*/

%put &amp;amp;www1.;/*21603*/
%put &amp;amp;www2.;/*23FEB2019*/
%put &amp;amp;www3.;/*'23FEB2019'dt*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 06 Apr 2019 12:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549034#M152295</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-04-06T12:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function-Why get null value in result??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549035#M152296</link>
      <description>&lt;P&gt;To get the next day date you do&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;tomorrow = toady +1;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Sas date counts days from 01JAN1960 as zero. You don't need INTNX function.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2019 12:54:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549035#M152296</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-06T12:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function-Why get null value in result??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549038#M152298</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159549"&gt;@Ronein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To your why-&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;"Hello&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;I am trying to use&amp;nbsp;INTNX function to get one day after&amp;nbsp; date in&amp;nbsp;start column.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;Why am I getting null value ?(In following statement:&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;OneDay_after_start&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;INTNX&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'day'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&amp;nbsp;start&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;"&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;Move your&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;OneDay_after_start=INTNX ('day', start, 1);&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token punctuation"&gt;Before&amp;nbsp;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;if eof then output;&lt;/P&gt;
&lt;P&gt;&lt;CODE class="  language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;See the below&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data tbl2;
set tbl1 end=eof;
OneDay_after_start=INTNX ('day', start, 1);
if eof then output;
/*OneDay_after_start=INTNX ('day', start, 1);*/
call symput('xxx1',start);
call symput('xxx2',put(start,date9.));
call symput('xxx3',"'"||put(start,date9.)||"'d");

call symput('www1',OneDay_after_start);
call symput('www2',put(OneDay_after_start,date9.));
call symput('www3',"'"||put(OneDay_after_start,date9.)||"'d");
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2019 13:09:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549038#M152298</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-06T13:09:36Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function-Why get null value in result??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549039#M152299</link>
      <description>&lt;P&gt;Your only output in this data step happens BEFORE any calculation takes place, therefore all new variables not contained in tbl1 will still be missing.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Apr 2019 13:28:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549039#M152299</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-04-06T13:28:18Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function-Why get null value in result?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549150#M152341</link>
      <description>&lt;P&gt;Also,&lt;/P&gt;
&lt;P&gt;1. Use call symputx() for numeric variables to&amp;nbsp;avoid&amp;nbsp;messages&amp;nbsp;in the&amp;nbsp;log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;call &lt;SPAN class="token function"&gt;symputx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'xxx1'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;START&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Your code is more efficient if you do nothing unless required to:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TBL2;
  set TBL1 end=EOF;
  if EOF ;
  ONEDAY_AFTER_START=intnx('day', START, 1);
  call&amp;nbsp;symputx()...
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;3. For even more efficiency and if the table is large, fetch the number of observations and use option FIRSTOBS=&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('nobs',NOBS);
  stop;
  if 0 then set TBL1 nobs=NOBS;
run;

data TBL2;
  set TBL1 (firstobs=&amp;amp;nobs.);
  ONEDAY_AFTER_START=intnx('day', START, 1);
  call&amp;nbsp;symputx()...
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2019 02:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549150#M152341</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-04-08T02:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: INTNX function-Why get null value in result?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549153#M152344</link>
      <description>&lt;P&gt;If SAS knows the number of observations then you could use POINT=.&amp;nbsp; Just be careful not to put the data step into an infinite loop.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
  if _n_&amp;gt;1 then stop;
  set sashelp.class point=nobs nobs=nobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Apr 2019 03:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/INTNX-function-Why-get-null-value-in-result/m-p/549153#M152344</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-08T03:30:48Z</dc:date>
    </item>
  </channel>
</rss>

