<?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: Calculation of date in SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933566#M367153</link>
    <description>&lt;P&gt;To add a detail or two to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s response.&lt;/P&gt;
&lt;P&gt;The largest value that SAS will recognize a date (i.e. number of days from 1Jan1960) is 31DEC20000 (yes 18,000 years in the future) which is 6589335. When you try to manipulated a number like 20230925 you would be dealing something about 3 times larger or in the year 60,000. So none of the SAS date functions recognize the value as a valid date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally for display none of the current SAS formats will display a year value past 9999&lt;/P&gt;</description>
    <pubDate>Mon, 24 Jun 2024 14:16:41 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-06-24T14:16:41Z</dc:date>
    <item>
      <title>Calculation of date in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933554#M367150</link>
      <description>&lt;P&gt;I have SAS codes below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let xstart30 = %sysfunc(putn(&amp;amp;nms_omt.-30,yymmddn8.));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log shows this:&amp;nbsp;&lt;/P&gt;&lt;P&gt;%put &amp;amp;nms_omt.;&lt;BR /&gt;20230925&lt;BR /&gt;%put &amp;amp;xstart30nms.;&lt;BR /&gt;********&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am wondering why there is no value for&amp;nbsp;&amp;amp;xstart30nms.? Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 13:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933554#M367150</guid>
      <dc:creator>yming954</dc:creator>
      <dc:date>2024-06-24T13:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of date in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933557#M367151</link>
      <description>&lt;P&gt;It doesn't work because the value&amp;nbsp;&lt;SPAN&gt;20230925 is not recognized by SAS as a date! It may be recognized by humans as a date, but not by SAS. You have to convert this value into something that SAS recognizes as a date. Example:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let nms_omt=20230925;
%let nms_omt1=%sysfunc(inputn(&amp;amp;nms_omt,yymmdd8.));
%put &amp;amp;=nms_omt1;
%put %sysfunc(putn(&amp;amp;nms_omt1,date9.));

%let xstart30 = %sysfunc(putn(&amp;amp;nms_omt1.-30,yymmddn8.));
%put &amp;amp;=xstart30;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS dates are the number of days since 01JAN1960. The INPUTN function above reads the date that humans might recognize (&lt;SPAN&gt;20230925)&lt;/SPAN&gt;&amp;nbsp;and converts it to the number of days since 01JAN1960 which SAS can recognize as a date. Then all arithmetic (like subtracting 30) and formats (like yymmddn8.) should work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 13:51:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933557#M367151</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-24T13:51:38Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of date in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933565#M367152</link>
      <description>&lt;P&gt;Thank you very much for your explanation&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 14:15:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933565#M367152</guid>
      <dc:creator>yming954</dc:creator>
      <dc:date>2024-06-24T14:15:18Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of date in SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933566#M367153</link>
      <description>&lt;P&gt;To add a detail or two to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;'s response.&lt;/P&gt;
&lt;P&gt;The largest value that SAS will recognize a date (i.e. number of days from 1Jan1960) is 31DEC20000 (yes 18,000 years in the future) which is 6589335. When you try to manipulated a number like 20230925 you would be dealing something about 3 times larger or in the year 60,000. So none of the SAS date functions recognize the value as a valid date.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Additionally for display none of the current SAS formats will display a year value past 9999&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jun 2024 14:16:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Calculation-of-date-in-SAS/m-p/933566#M367153</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-06-24T14:16:41Z</dc:date>
    </item>
  </channel>
</rss>

