<?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 How do I reference a variable in the intnx function in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634656#M77987</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to identify those people in my dataset, who died before their 80th birthday. I have their birthdate as well as the date of death. I tried to use the intnx function of SAS to compare the date of the 80th birthday and the date of death. Since I have a lot of entries in my dataset, I tried to reference the variable for the birthdate (geb_dat) instead of inserting the dates manually. However, I'm getting errors:&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;data mi_olink_CR;
	set dataset.mi_olink;
	if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This produces the following log statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;120  data mi_olink_CR;
121      set dataset.mi_olink;
122      if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
                       -----------------
                       49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.

123  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I have to reference the variable geb_dat (DATE9. Format)from the mi_olink_CR dataset in the intnx function?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Arik&lt;/P&gt;</description>
    <pubDate>Wed, 25 Mar 2020 09:47:25 GMT</pubDate>
    <dc:creator>Arik</dc:creator>
    <dc:date>2020-03-25T09:47:25Z</dc:date>
    <item>
      <title>How do I reference a variable in the intnx function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634656#M77987</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to identify those people in my dataset, who died before their 80th birthday. I have their birthdate as well as the date of death. I tried to use the intnx function of SAS to compare the date of the 80th birthday and the date of death. Since I have a lot of entries in my dataset, I tried to reference the variable for the birthdate (geb_dat) instead of inserting the dates manually. However, I'm getting errors:&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;data mi_olink_CR;
	set dataset.mi_olink;
	if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This produces the following log statement:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;120  data mi_olink_CR;
121      set dataset.mi_olink;
122      if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
                       -----------------
                       49
NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS
             release.  Inserting white space between a quoted string and the succeeding
             identifier is recommended.

123  run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I have to reference the variable geb_dat (DATE9. Format)from the mi_olink_CR dataset in the intnx function?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Arik&lt;/P&gt;</description>
      <pubDate>Wed, 25 Mar 2020 09:47:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634656#M77987</guid>
      <dc:creator>Arik</dc:creator>
      <dc:date>2020-03-25T09:47:25Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reference a variable in the intnx function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634658#M77988</link>
      <description>&lt;P&gt;Looks to me like unbalanced quotes further up in the code.&lt;/P&gt;
&lt;P&gt;This works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input geb_dat :yymmdd10. mort_dat :yymmdd10.;
format geb_dat mort_dat yymmddd10.;
datalines;
1930-05-05 2011-04-03
1950-06-03 2012-05-04
;

data want;
set have;
if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Log:&lt;/P&gt;
&lt;PRE&gt; 73         data have;
 74         input geb_dat :yymmdd10. mort_dat :yymmdd10.;
 75         format geb_dat mort_dat yymmddd10.;
 76         datalines;
 
 NOTE: The data set WORK.HAVE has 2 observations and 2 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
       
 
 79         ;
 80         
 81         
 82         data want;
 83         set have;
 84         if intnx('year', geb_dat, 80, 'same')&amp;gt; mort_dat then put 'died before 80th birthday';
 85         run;
 
 died before 80th birthday
 NOTE: There were 2 observations read from the data set WORK.HAVE.
 NOTE: The data set WORK.WANT has 2 observations and 2 variables.
 NOTE:  Verwendet wurde: DATA statement - (Gesamtverarbeitungszeit):
       real time           0.00 seconds
       cpu time            0.00 seconds
&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Mar 2020 09:56:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634658#M77988</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-25T09:56:04Z</dc:date>
    </item>
    <item>
      <title>Re: How do I reference a variable in the intnx function</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634674#M77993</link>
      <description>Thanks for your prompt reply!&lt;BR /&gt;Your code worked for me as well. Seems like I had a typo in the variable for birthdate.</description>
      <pubDate>Wed, 25 Mar 2020 10:22:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-do-I-reference-a-variable-in-the-intnx-function/m-p/634674#M77993</guid>
      <dc:creator>Arik</dc:creator>
      <dc:date>2020-03-25T10:22:36Z</dc:date>
    </item>
  </channel>
</rss>

