<?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 convert date into days in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759575#M240064</link>
    <description>&lt;P&gt;And just what "integer value" do you expect for that date?&lt;/P&gt;</description>
    <pubDate>Thu, 05 Aug 2021 01:01:09 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-08-05T01:01:09Z</dc:date>
    <item>
      <title>how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759567#M240056</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have birthdate in&amp;nbsp;&amp;nbsp;mm/dd/yyyy format. How can I calculate or convert it into days ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For eg, birthdate is 04/16/1997. I want integer values of that date.&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>Thu, 05 Aug 2021 00:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759567#M240056</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-08-05T00:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759572#M240061</link>
      <description>&lt;P&gt;Integer_Value = INPUT(Character_Value, MMDDYY10.);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data	_NULL_;
    Character_Value	=	PUT(TODAY(), MMDDYYS10.);
    Integer_Value   =  INPUT(Character_Value, MMDDYY10.);
    PUTLOG	"NOTE:  "  Character_Value=  Integer_Value=;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results:&lt;/P&gt;
&lt;PRE&gt;NOTE:  Character_Value=08/04/2021 Integer_Value=22496&lt;/PRE&gt;
&lt;P&gt;Be aware that the integer is a count of days since January 1st, 1960.&amp;nbsp; January 1st, 1960 is 0; January 2nd, 1960 is 1; January 3rd, 1960 is 2, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 00:39:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759572#M240061</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-05T00:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759575#M240064</link>
      <description>&lt;P&gt;And just what "integer value" do you expect for that date?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 01:01:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759575#M240064</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-08-05T01:01:09Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759653#M240110</link>
      <description>&lt;P&gt;A date in SAS &lt;STRONG&gt;is&lt;/STRONG&gt; an integer (count of days from 1960-01-01). Do you need to calculate an offset from another date?&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 08:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759653#M240110</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-05T08:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759720#M240138</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;A date in SAS &lt;STRONG&gt;is&lt;/STRONG&gt; an integer (count of days from 1960-01-01). Do you need to calculate an offset from another date?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;, if you have a SAS date, you already have an integer, an integer that represents a count of the number of days since January 1, 1960.&amp;nbsp; The question is:&amp;nbsp; &lt;STRONG&gt;Is this the integer that you want?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some software (e.g. Excel) considers January 1, 1900 as Day 0.&amp;nbsp; SAS considers January 1, 1960 as Day 0.&amp;nbsp; Some may wish to count starting with January 1 of the year 1 A.D. as Day 0.&amp;nbsp; &lt;STRONG&gt;What do you want your integer value to represent?&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 14:59:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759720#M240138</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-05T14:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759769#M240162</link>
      <description>Yes, I need the Integer.</description>
      <pubDate>Thu, 05 Aug 2021 17:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759769#M240162</guid>
      <dc:creator>RAVI2000</dc:creator>
      <dc:date>2021-08-05T17:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759770#M240163</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes, I need the Integer.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;OK, great.&amp;nbsp; Did my earlier reply help you to get that integer?&amp;nbsp; And what do you want that integer to represent?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 17:38:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759770#M240163</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-08-05T17:38:08Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759772#M240164</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have birthdate in&amp;nbsp;&amp;nbsp;mm/dd/yyyy format. How can I calculate or convert it into days ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For eg, birthdate is 04/16/1997. I want integer values of that date.&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;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note that SAS variables are not &lt;STRONG&gt;IN&lt;/STRONG&gt; any format. The value is stored as either a fixed length character string or a floating point number.&amp;nbsp; A format is instructions on how to display the values as text.&amp;nbsp; A variable can have a format permanently attached to override the default way that SAS would normally display the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you have a numeric variable BIRTHDATE with the MMDDYY10. format &lt;STRONG&gt;attached&lt;/STRONG&gt; to it then you already have BIRTHDATE as an integer.&amp;nbsp; If you want SAS to display it as an integer just remove the format.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format birthdate;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or attach a different format:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;format bithdate comma7.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a character variable BIRTHDATE with strings in the style of MM/DD/YY then use the INPUT() function with the MMDDYY informat to convert the string into a number.&amp;nbsp; You will need to create a new variable to store the number.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;birthdate_number = input(birthdate,mmddyy10.);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Again either do not attach any format it to it or a format that displays the integer in the way you would like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't like the integers that SAS uses to store dates then explain what types of integers you want instead.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 17:46:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759772#M240164</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-05T17:46:23Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert date into days</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759777#M240168</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294544"&gt;@RAVI2000&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Yes, I need the Integer.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Per definition, there is an infinite number of integers.&lt;/P&gt;
&lt;P&gt;And even with the limitations of SAS, this still means 2 to the power of 54.&lt;/P&gt;
&lt;P&gt;So you need to be much more specific and tell us&amp;nbsp;&lt;EM&gt;which&lt;/EM&gt; integer you need.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Aug 2021 18:15:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-date-into-days/m-p/759777#M240168</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-05T18:15:51Z</dc:date>
    </item>
  </channel>
</rss>

