<?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: SAS dataset in numeric data type #date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933693#M367216</link>
    <description>&lt;P&gt;Think about it this way&lt;/P&gt;
&lt;P&gt;0 is 01JAN1960&lt;/P&gt;
&lt;P&gt;1 is 02JAN1960&lt;/P&gt;
&lt;P&gt;2 is 03JAN1960&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;365 is 31DEC1960&lt;/P&gt;
&lt;P&gt;366 is 01JAN1961&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or a simple program will clear this up&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    do dt=0 to 368 by 1;
        dt1=dt;
        output;
    end;
    format dt1 $date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 25 Jun 2024 16:47:10 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2024-06-25T16:47:10Z</dc:date>
    <item>
      <title>SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933691#M367215</link>
      <description>I have one doubt about why in that point of 01Jan1960 is 0 then next year that is 366 I can't understand it well&lt;BR /&gt;Anyone pls clear my doubt !!!</description>
      <pubDate>Tue, 25 Jun 2024 16:06:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933691#M367215</guid>
      <dc:creator>Bhagyalakshmi</dc:creator>
      <dc:date>2024-06-25T16:06:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933693#M367216</link>
      <description>&lt;P&gt;Think about it this way&lt;/P&gt;
&lt;P&gt;0 is 01JAN1960&lt;/P&gt;
&lt;P&gt;1 is 02JAN1960&lt;/P&gt;
&lt;P&gt;2 is 03JAN1960&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;365 is 31DEC1960&lt;/P&gt;
&lt;P&gt;366 is 01JAN1961&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or a simple program will clear this up&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data a;
    do dt=0 to 368 by 1;
        dt1=dt;
        output;
    end;
    format dt1 $date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Jun 2024 16:47:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933693#M367216</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-06-25T16:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933708#M367223</link>
      <description>&lt;P&gt;SAS dates are&amp;nbsp;&lt;EM&gt;counts of days&lt;/EM&gt;, with 1960-01-01 being day zero. Since 1960 was a leap year, 1961-01-01 is day 366.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jun 2024 18:32:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/933708#M367223</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-25T18:32:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934058#M367341</link>
      <description>&lt;P&gt;why we are adding 366 count extra date for 01jan1961 is it condition to add for every year start with first day?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 13:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934058#M367341</guid>
      <dc:creator>Bhagyalakshmi</dc:creator>
      <dc:date>2024-06-28T13:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934063#M367342</link>
      <description>&lt;P&gt;I repeat: SAS dates are&amp;nbsp;&lt;STRONG&gt;counts of days&lt;/STRONG&gt;, and since 1960 was a leap year with 366 days, and the count starts at the beginning of 1960, 1961-01-01 will be day #366.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 13:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934063#M367342</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-06-28T13:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS dataset in numeric data type #date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934068#M367345</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/446959"&gt;@Bhagyalakshmi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;why we are adding 366 count extra date for 01jan1961 is it condition to add for every year start with first day?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not sure what you are asking.&amp;nbsp; But the better way to think about is that SAS is just counting days (not years).&amp;nbsp; Some years have 365 days and others&amp;nbsp;(leap years) have 366 days&amp;nbsp; 1960 happens to be one that has 366 days.&amp;nbsp; The first day of 1960 is stored as 0.&amp;nbsp; Hence the first day of 1961 is 366 days later which is 366.&amp;nbsp; The first day of 1962 is 365 days later which is the number 731.&amp;nbsp; Dates before 1/1/1960 will be stored as negative numbers.&amp;nbsp; Since 1959 had 365 days the first day of 1959 is the number -365.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's check how many days the years from 1958 to 1962 have.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  do year=1958 to 1963 ;
    date=mdy(1,1,year);
    number=date;
    days_last_year=dif(date);
    output;
  end;
  format date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1719584446746.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/97971iD1BF155372C4BF3F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Tom_0-1719584446746.png" alt="Tom_0-1719584446746.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2024 14:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-dataset-in-numeric-data-type-date/m-p/934068#M367345</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-06-28T14:20:54Z</dc:date>
    </item>
  </channel>
</rss>

