<?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: How to use INTNX on a char field? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737443#M229904</link>
    <description>&lt;P&gt;&lt;EM&gt;&amp;gt; a formula which we could use and would mimic SQL function&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you use the formula for? Create a new table? The result is a SAS date field? Is the formula is a data step or a SQL query?&lt;/P&gt;</description>
    <pubDate>Tue, 27 Apr 2021 21:21:28 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-04-27T21:21:28Z</dc:date>
    <item>
      <title>How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/736994#M229709</link>
      <description>&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; question;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; length&amp;nbsp; dateBegin dateEnd $&lt;STRONG&gt;100&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dateBegin="2019-10-14"; dateEnd="2020-10-14"; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dateBegin="2019-10-16"; dateEnd=""; output;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;We have a huge table where &lt;STRONG&gt;2&lt;/STRONG&gt; columns contain dates which are stored as char length &lt;STRONG&gt;100&lt;/STRONG&gt; ( I know it's not the best but I can't change that).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They want to send us a formula which we could use and would mimic SQL function or feature DateAdd (ex:DateAdd (YYYY, 1, "2019-10-14") ).&lt;/P&gt;&lt;P&gt;So intnx does the same thing in a way with Dates.&amp;nbsp; However how can I use it to increment a year on a char field?&amp;nbsp; SAS is complaining as it is not a date datatype.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Formula sent to our table :&amp;nbsp; if missing(dateEnd) then intnx('year',dateBegin, 1);&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 13:49:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/736994#M229709</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-26T13:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/736995#M229710</link>
      <description>&lt;P&gt;You can't use INTNX on character variables. It can only be used on &lt;STRIKE&gt;text&lt;/STRIKE&gt; numeric variables. So, make your variables numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data question;
    dateBegin="14OCT2019"d; dateEnd="14OCT2020"d; output;
    dateBegin="16OCT2019"d; dateEnd=.; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or convert them to numeric using the INPUT function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dateBegin="2019-10-14";
dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 14:43:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/736995#M229710</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-26T14:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737001#M229714</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You can't use INTNX on character variables. It can only be used on text variables. So, make your variables numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data question;
    dateBegin="14OCT2019"d; dateEnd="14OCT2020"d; output;
    dateBegin="16OCT2019"d; dateEnd=.; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or convert them to numeric using the INPUT function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dateBegin="2019-10-14";
dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you meant to type "It can only be used on numeric variables." instead of "text variables".&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 14:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737001#M229714</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-26T14:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737002#M229715</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You can't use INTNX on character variables. It can only be used on text variables. So, make your variables numeric.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data question;
    dateBegin="14OCT2019"d; dateEnd="14OCT2020"d; output;
    dateBegin="16OCT2019"d; dateEnd=.; output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or convert them to numeric using the INPUT function&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;dateBegin="2019-10-14";
dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you meant to type "It can only be used on numeric variables." instead of "text variables".&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;yes, that's what I meant, thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 14:43:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737002#M229715</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-26T14:43:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737011#M229718</link>
      <description>&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry I am almost there ...at the end, my dateEnd has to be back into a char value.&lt;/P&gt;&lt;P&gt;There is something I am doing wrong in my conversion below so that I get the correct date;&amp;nbsp; now it is not incrementing by 1 year.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data&lt;/STRONG&gt; question_result(drop=dateBegin_numeric);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set question;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if missing(dateEnd) then dateBegin_numeric=intnx('year',dateBegin_numeric, &lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* almost there...but not the right result */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; dateEnd=put(dateBegin_numeric,yymmdd10.);&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:10:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737011#M229718</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-26T15:10:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737012#M229719</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247133"&gt;@PopCorn14&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you very much&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry I am almost there ...at the end, my dateEnd has to be back into a char value.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why does it have to be character? Dates in SAS are numeric!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;There is something I am doing wrong in my conversion below so that I get the correct date;&amp;nbsp; now it is not incrementing by 1 year.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;What is it doing? Explain.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 15:14:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737012#M229719</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-26T15:14:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737035#M229725</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It's not my choice, the table is coming from a huge program, some manipulation will be done to it and then that table will be shipped to another program.&amp;nbsp; Therefore I cannot change the datatype.I will have to drop the column dateBegin_numeric after the conversion.&lt;/P&gt;&lt;P&gt;What I meant is the date in the second line "dateEnd" has not been incremented by a year.&amp;nbsp; See picture.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dateINTNX.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58689iFDC908A975A54D20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dateINTNX.jpg" alt="dateINTNX.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:12:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737035#M229725</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-26T16:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737040#M229728</link>
      <description>oups...wrong code&lt;BR /&gt;&lt;BR /&gt;data question_result; /*(drop=dateBegin_numeric);*/&lt;BR /&gt;set question;&lt;BR /&gt;if missing(dateEnd) then do;&lt;BR /&gt;dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;BR /&gt;dateBegin_numeric=intnx('year',dateBegin_numeric, 1);&lt;BR /&gt;/* almost there...but not the right result */&lt;BR /&gt;dateEnd=put(dateBegin_numeric,yymmdd10.);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:20:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737040#M229728</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-26T16:20:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737045#M229731</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247133"&gt;@PopCorn14&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;oups...wrong code&lt;BR /&gt;&lt;BR /&gt;data question_result; /*(drop=dateBegin_numeric);*/&lt;BR /&gt;set question;&lt;BR /&gt;if missing(dateEnd) then do;&lt;BR /&gt;dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;BR /&gt;dateBegin_numeric=intnx('year',dateBegin_numeric, 1);&lt;BR /&gt;/* almost there...but not the right result */&lt;BR /&gt;dateEnd=put(dateBegin_numeric,yymmdd10.);&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It really helps to describe what is "not right". Otherwise we have to guess.&lt;/P&gt;
&lt;P&gt;I suspect that you want the yymmddX.w format. The X is a placeholder for a letter to indicate the desired separator between the values. If you want a dash or hyphen then yymmddd10. (yes 3 d's)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;DIV class="xis-refDictEntry"&gt;
&lt;DIV class="xis-syntax"&gt;
&lt;DIV class="xis-syntaxDescription"&gt;
&lt;DIV class="xis-otherArgGroup"&gt;
&lt;DIV id="p1bwurij51kqstn128ma7u6r7v7b" class="xis-argDescriptionPair"&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;DIV id="p0s22supzt7tgcn1f5621tfjrg61" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;B&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;separates with a blank.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p1w6uc1n8elzp7n0zkyq199fiz7t" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;C&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;separates with a colon.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n1v4wfcfn3eb6kn1fo3xqgw8kydi" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;D&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;separates with a hyphen.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p1q1sn2kg531m0n1wy78ghsuscg2" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;N&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;indicates no separator.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="n09k41rq2cn6atn165xn2rqqfv0t" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;P&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;separates with a period.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV id="p08qzmhjmxuuwxn15u11gzubte8a" class="xis-argDescriptionPair"&gt;
&lt;H4 class="xis-argument"&gt;S&lt;/H4&gt;
&lt;DIV class="xis-argumentDescription"&gt;
&lt;P class="xis-paraSimpleFirst"&gt;separates with a slash.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737045#M229731</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-26T16:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737046#M229732</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247133"&gt;@PopCorn14&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not my choice, the table is coming from a huge program, some manipulation will be done to it and then that table will be shipped to another program.&amp;nbsp; Therefore I cannot change the datatype.I will have to drop the column dateBegin_numeric after the conversion.&lt;/P&gt;
&lt;P&gt;What I meant is the date in the second line "dateEnd" has not been incremented by a year.&amp;nbsp; See picture.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="dateINTNX.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58689iFDC908A975A54D20/image-size/medium?v=v2&amp;amp;px=400" role="button" title="dateINTNX.jpg" alt="dateINTNX.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;In SAS, you do the manipulations with a numeric variable. If you have to send it to another program as character (I'm skeptical that it requires character, what program?), then you use formats in SAS to make the variable appear as character.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 16:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737046#M229732</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-04-26T16:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737078#M229746</link>
      <description>&lt;P&gt;You do not (as in&amp;nbsp;&lt;FONT size="6"&gt;&lt;STRONG&gt;NOT&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT size="3"&gt;) store dates in this way in SAS. You simply don't.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;SAS dates are counts of days, starting with 1960-01-01 as day zero, stored as numbers, with a date format attached so that the value is human-readable.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;If you need to export the dates to another application in a specific format, this is done when the export happens, but while you work with the data in SAS, dates have to be stored as numbers, as described above. Otherwise you deprive yourself of all the nice tools SAS provides out of the box for working with such data.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="3"&gt;Since the numeric values of dates are in a quite limited range, you can use a length of 4 for the numeric variables, so you also have a significant saving in terms of space.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:08:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737078#M229746</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-26T18:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737082#M229748</link>
      <description>&lt;P&gt;Thank You&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know dates in SAS shouldn't be char etc......but client needs this change done on these 2 char fields.&lt;/P&gt;&lt;P&gt;What I meant is that we have a table with multiple columns (numeric and chars) which goes through multiple processing depending on different modules.&amp;nbsp; It happens that recently the client noticed that these 2 char fields need to be filled all the time.&amp;nbsp; These 2 fields need to stay char ..sorry but they have their reason for other programs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your solution with the input which made the use of intnx worked.&amp;nbsp; Now the only thing missing, is how can I get dateBegin_numeric back into dateBegin (char)&amp;nbsp; ? (I know it's terrible but I have no choice).&amp;nbsp; &amp;nbsp; I must be doing something wrong with the "put" statement as&amp;nbsp;the result doesn't show the date incremented by a year. The format is YYYY-MM-DD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data question_result; /*(drop=dateBegin_numeric);*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; set question;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if missing(dateEnd) then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*Solution from Paige*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dateBegin_numeric=input(dateBegin,yymmdd10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dateBegin_numeric=intnx('year',dateBegin_numeric, &lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* right format but it wasn't incremented by 1 year ?&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dateEnd=put(dateBegin_numeric,yymmdd10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="INTNX2.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/58699i1623AABF99EC44C7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="INTNX2.jpg" alt="INTNX2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 18:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737082#M229748</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-26T18:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737178#M229783</link>
      <description>&lt;P&gt;You need to use the fourth parameter of intnx, it default to "beginning", but you need "same".&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 07:19:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737178#M229783</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-04-27T07:19:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737180#M229785</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
input (date_begin date_end) (:$10.);
datalines;
2019-10-14 2020-10-14
2019-10-16
;

data want;
set have;
if missing(date_end)
then date_end = put(intnx('year',input(date_begin,yymmdd10.),1,'s'),yymmdd10.);
run;

proc print data=want noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;PRE&gt;date_begin	date_end
2019-10-14	2020-10-14
2019-10-16	2020-10-16&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Apr 2021 07:50:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737180#M229785</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-27T07:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737423#M229884</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;Alleluia. Thank you so much.&amp;nbsp; That is what I wasn't able to get.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Like I said,&amp;nbsp; I know that dates are NOT supposed to be stored in char.&amp;nbsp; It is a specific request from clients on a huge table containing just a few char columns. This table is then sent to another huge program that will transpose etc...therefore I am NOT in position to change the length on any columns etc...Sometimes we need to do strange things.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 20:52:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737423#M229884</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-27T20:52:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737426#M229887</link>
      <description>Thank you very much &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. I always have issues with the format. I will keep your notes handy.</description>
      <pubDate>Tue, 27 Apr 2021 20:55:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737426#M229887</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-27T20:55:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737427#M229888</link>
      <description>I will keep that in mind. Thank you very much.</description>
      <pubDate>Tue, 27 Apr 2021 20:56:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737427#M229888</guid>
      <dc:creator>PopCorn14</dc:creator>
      <dc:date>2021-04-27T20:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to use INTNX on a char field?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737443#M229904</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; a formula which we could use and would mimic SQL function&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What do you use the formula for? Create a new table? The result is a SAS date field? Is the formula is a data step or a SQL query?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Apr 2021 21:21:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-use-INTNX-on-a-char-field/m-p/737443#M229904</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-04-27T21:21:28Z</dc:date>
    </item>
  </channel>
</rss>

