<?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 Subtract exactly one year from a date in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958514#M43037</link>
    <description>&lt;P&gt;Hi guys, I have a date like this: 01JUL2021. How can I get 01JUL2020? I need to subtract exactly one year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following but without success. The date is no more "01JUL"&lt;/P&gt;
&lt;PRE&gt;my_new_date = INTNX('YEAR',mydate,-1);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;</description>
    <pubDate>Thu, 06 Feb 2025 09:42:50 GMT</pubDate>
    <dc:creator>NewUsrStat</dc:creator>
    <dc:date>2025-02-06T09:42:50Z</dc:date>
    <item>
      <title>Subtract exactly one year from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958514#M43037</link>
      <description>&lt;P&gt;Hi guys, I have a date like this: 01JUL2021. How can I get 01JUL2020? I need to subtract exactly one year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following but without success. The date is no more "01JUL"&lt;/P&gt;
&lt;PRE&gt;my_new_date = INTNX('YEAR',mydate,-1);&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you in advance&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 09:42:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958514#M43037</guid>
      <dc:creator>NewUsrStat</dc:creator>
      <dc:date>2025-02-06T09:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract exactly one year from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958515#M43038</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Use &lt;FONT face="courier new,courier"&gt;'s'&lt;/FONT&gt; (the "&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm#n1vvtep7sym1n2n1a6x9n1lqtcwf" target="_blank" rel="noopener"&gt;SAME alignment&lt;/A&gt;") in the fourth argument of the INTNX function:&lt;/P&gt;
&lt;PRE&gt;my_new_date = INTNX('YEAR',mydate,-1,&lt;STRONG&gt;&lt;FONT color="#00DD00"&gt;'s'&lt;/FONT&gt;&lt;/STRONG&gt;);&lt;/PRE&gt;
&lt;P&gt;The default is &lt;FONT face="courier new,courier"&gt;'b'&lt;/FONT&gt; (beginning).&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 09:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958515#M43038</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2025-02-06T09:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract exactly one year from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958520#M43039</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/134532"&gt;@NewUsrStat&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi guys, I have a date like this: 01JUL2021. How can I get 01JUL2020? I need to subtract exactly one year.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I tried the following but without success. The date is no more "01JUL"&lt;/P&gt;
&lt;PRE&gt;my_new_date = INTNX('YEAR',mydate,-1);&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So just to be 100% complete, when a date is 01JUL2021 in a numeric variable, then &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh&lt;/a&gt; has the solution. But if the date of 01JUL2021 is in a character variable (is it? you don't tell us) then that won't work. Then you want this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;one_year_ago = intnx('year',input(char_date_variable_name,date9.),-1,'s');&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 10:21:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958520#M43039</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-02-06T10:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: Subtract exactly one year from a date</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958532#M43040</link>
      <description>&lt;P&gt;Maxim 1: Read the Documentation&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lefunctionsref/p10v3sa3i4kfxfn1sovhi5xzxh8n.htm#p11jca64z7ugarn1f65kiq9r3pip" target="_blank" rel="noopener"&gt;INTNX Function: Alignment&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2025 13:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Subtract-exactly-one-year-from-a-date/m-p/958532#M43040</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2025-02-06T13:32:28Z</dc:date>
    </item>
  </channel>
</rss>

