<?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: sysfunc to convert SAS date does not work in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636323#M189043</link>
    <description>&lt;P&gt;Generally you don't need %SYSFUNC when data step operations will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's not really clear what you are doing or what the purpose of this line is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;file=rec_&amp;amp;year.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks like you are creating a new variable FILE which is equal to some other variable, but there are no variables named rec_xxxxx, so it is a meaningless line at this point in time. Please explain what this data step is supposed to be doing.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Mar 2020 18:52:36 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-03-31T18:52:36Z</dc:date>
    <item>
      <title>intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636310#M189027</link>
      <description>&lt;P&gt;I have the following macro definition and be stuck in middle&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let From_Date = JAN07;&lt;/P&gt;&lt;P&gt;%let new_input=%sysfunc(inputn("JAN07"d, MONYY5.));&lt;BR /&gt;%let new_input=%sysfunc(inputn(&amp;amp;From_Date., MONYY5.));&lt;BR /&gt;%put &amp;amp;new_input.;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data test;&lt;BR /&gt;do k=0 to 10;&lt;BR /&gt;y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. the second clause can not read in 'JAN07"d', the 3th clause can output correctly, why this happen.&lt;/P&gt;&lt;P&gt;2. in loop, k can not be recognized by intnx function as a number, the error is&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"Argument 3 to function INTNX referenced by the %SYSFUNC or %QSYSFUNC macro function is not a number."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 17:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636310#M189027</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T17:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636311#M189028</link>
      <description>&lt;P&gt;Macro variables SHOULD NOT be formatted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let From_Date = %sysevalf('01JAN07'd); /* Un-format the date */
%let new_input=&amp;amp;From_Date;
%put &amp;amp;new_input.;

data test;
do k=0 to 10;
y= intnx('month', &amp;amp;new_input., k , 'e');
output;
end;
format y date7.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:05:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636311#M189028</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-31T18:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636312#M189029</link>
      <description>&lt;P&gt;For a DATE literal, quoted string followed by the letter D, the string must be something the DATE informat can read.&amp;nbsp; You tried to use a value that did not include a value for the day of the month.&amp;nbsp; You were able to convert that to date using the&amp;nbsp;MONYY informat because it assumes you want the first day of the month.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can mimic that if you want.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let From_Month = JAN2007;
%let From_Date = "01&amp;amp;From_Month"d ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS Do NOT use only two digits for years.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:17:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636312#M189029</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-31T18:17:15Z</dc:date>
    </item>
    <item>
      <title>Re: sysfunc to convert SAS date does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636315#M189042</link>
      <description>Thank,&lt;BR /&gt;I need to convert it back to date, as below&lt;BR /&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;do k=0 to 10;&lt;BR /&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;BR /&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;BR /&gt;year=%sysfunc(putn(y, MONYY5.));&lt;BR /&gt;file=rec_&amp;amp;year.;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but this time the %sysfunc() told me y is not a number.</description>
      <pubDate>Tue, 31 Mar 2020 18:26:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636315#M189042</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T18:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Function name missing in %SYSFUNC or %QSYSFUNC macro function reference.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636317#M189046</link>
      <description>Thank,&lt;BR /&gt;I need to convert it back to date, as below&lt;BR /&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;do k=0 to 10;&lt;BR /&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;BR /&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;BR /&gt;year=%sysfunc(putn(y, MONYY5.));&lt;BR /&gt;file=rec_&amp;amp;year.;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but this time the %sysfunc() told me y is not a number.</description>
      <pubDate>Tue, 31 Mar 2020 18:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636317#M189046</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T18:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636318#M189034</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank, y value works. however,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert it back to date, as below&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;data test2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do k=0 to 10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;year=%sysfunc(putn(y, MONYY5.));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;file=rec_&amp;amp;year.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but this time the %sysfunc() told me y is not a number.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636318#M189034</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T18:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636322#M189036</link>
      <description>&lt;P&gt;the saved files using 2 digit for year.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636322#M189036</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T18:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: sysfunc to convert SAS date does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636323#M189043</link>
      <description>&lt;P&gt;Generally you don't need %SYSFUNC when data step operations will work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's not really clear what you are doing or what the purpose of this line is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;file=rec_&amp;amp;year.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It looks like you are creating a new variable FILE which is equal to some other variable, but there are no variables named rec_xxxxx, so it is a meaningless line at this point in time. Please explain what this data step is supposed to be doing.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636323#M189043</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-31T18:52:36Z</dc:date>
    </item>
    <item>
      <title>Re: sysfunc to convert SAS date does not work</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636324#M189044</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267606"&gt;@fsuzhang&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank,&lt;BR /&gt;I need to convert it back to date, as below&lt;BR /&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;do k=0 to 10;&lt;BR /&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;BR /&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;BR /&gt;year=%sysfunc(putn(y, MONYY5.));&lt;BR /&gt;file=rec_&amp;amp;year.;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but this time the %sysfunc() told me y is not a number.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That is just gibberish code. You are setting the numeric dataset variable Y to a date value.&amp;nbsp; You then create a character dataset variable named YEAR that has a string like 'JAN07'.&amp;nbsp; You then set the dataset variable FILE to the value of dataset variable whose name was created by appending the value of the macro variable YEAR to the letters REC_.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You do not show where you are creating the macro variable YEAR.&amp;nbsp; Nor are you creating any variables whose names start with REC_, no matter what value the macro variable YEAR had when the data step was compiled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is it that you are trying to do?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636324#M189044</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-31T18:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636326#M189039</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267606"&gt;@fsuzhang&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;SPAN&gt;Thank, y value works. however,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I need to convert it back to date, as below&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;data test2;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do k=0 to 10;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;year=%sysfunc(putn(y, MONYY5.));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;file=rec_&amp;amp;year.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;output;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;but this time the %sysfunc() told me y is not a number.&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Important concept: get the DATA step and other SAS code to work properly without macros and without macro variables for one instance, such as for a specific date, hard-coded. Once you get that to work properly without macros and without macro variables, then you have a chance to get it to work with macros and with macro variables. If you can't get that to work properly without macros and without macro variables, then it will never work with macros and macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, show us code that works with one hard-coded date, and no macros and no macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As written, your DATA step is meaningless. Explain what it is supposed to be doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And please don't post the same question in two places.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:36:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636326#M189039</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-31T18:36:53Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR: Function name missing in %SYSFUNC or %QSYSFUNC macro function reference.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636329#M189047</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/267606"&gt;@fsuzhang&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thank,&lt;BR /&gt;I need to convert it back to date, as below&lt;BR /&gt;&lt;BR /&gt;data test2;&lt;BR /&gt;do k=0 to 10;&lt;BR /&gt;/*y= %sysfunc(intnx(month, &amp;amp;new_input., k , 'e'));*/&lt;BR /&gt;y=intnx('month', &amp;amp;new_input., k , 'e');&lt;BR /&gt;year=%sysfunc(putn(y, MONYY5.));&lt;BR /&gt;file=rec_&amp;amp;year.;&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;but this time the %sysfunc() told me y is not a number.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You should open a new post, anyway - there is no need to use %sysfunc in a datastep&lt;/P&gt;
&lt;P&gt;where you can use the sas function directly.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:44:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636329#M189047</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-03-31T18:44:35Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636330#M189048</link>
      <description>&lt;P&gt;I moved the messages added to other (somewhat) related posts into this thread.&lt;/P&gt;
&lt;P&gt;In future if you want to ask a new question that is related to a question then make a new post.&amp;nbsp; You can include a link back to the old post to help explain your new question.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:52:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636330#M189048</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-31T18:52:04Z</dc:date>
    </item>
    <item>
      <title>Re: intnx error in reference is not a number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636331#M189049</link>
      <description>&lt;P&gt;sorry, in a hurry, I posted to wrong thread.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Mar 2020 18:54:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/intnx-error-in-reference-is-not-a-number/m-p/636331#M189049</guid>
      <dc:creator>fsuzhang</dc:creator>
      <dc:date>2020-03-31T18:54:07Z</dc:date>
    </item>
  </channel>
</rss>

