<?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: Date Format Issues in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595805#M15859</link>
    <description>&lt;P&gt;Looks like it is doing what you asked.&amp;nbsp; Consider this little program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   input x;
   year=year(x);
   month=month(x);
   day=day(x);
   put (_all_) (= comma12.);
cards;
01082012
04112007
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;x=1,082,012 year=4,922 month=6 day=14
x=4,112,007 year=13,218 month=4 day=20&lt;/PRE&gt;
&lt;P&gt;So one million days since 1960 is in the middle of the year 4922. 4 million days is after the start of the year 13,218!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First convert the value to an actual date (at least for the numbers that are valid dates).&amp;nbsp; Then you can use the value as a date and attach any date format you want to use when display the values.&amp;nbsp; Personally I avoid MMDDYY or DDMMYY format as whichever one you pick half of your audience will be confused.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;fixed=input(put(transaction_date,Z8.),mmddyy8.);
format fixed yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 11 Oct 2019 16:19:47 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-10-11T16:19:47Z</dc:date>
    <item>
      <title>Date Format Issues</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595802#M15856</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am having some trouble changing my date variable to a usable format. I have been able to change it to the 8 digit, MMDDYYYY format, but once I try to put the parathesis in to make it DD/MM/YYYY the numbers completely change and everything gets messy. I have offered photos for reference.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date1.PNG" style="width: 120px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33083i42DAA81794815625/image-size/large?v=v2&amp;amp;px=999" role="button" title="date1.PNG" alt="date1.PNG" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="date2.PNG" style="width: 123px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/33082i8FE9355939CD6ABE/image-size/large?v=v2&amp;amp;px=999" role="button" title="date2.PNG" alt="date2.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the only code I used for this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data want;&lt;BR /&gt;set have;&lt;BR /&gt;format transaction_date MMDDYY10.;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 15:54:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595802#M15856</guid>
      <dc:creator>marleeakerson</dc:creator>
      <dc:date>2019-10-11T15:54:11Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format Issues</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595803#M15857</link>
      <description>Your first variable is a number, but not a SAS date. You first need to convert it to a SAS date and then apply the format. &lt;BR /&gt;&lt;BR /&gt;transaction_date_sas = input(put(transaction_date, mmddyy10.), mmddyy10.);&lt;BR /&gt;format transaction_date ddmmyy10.;</description>
      <pubDate>Fri, 11 Oct 2019 16:03:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595803#M15857</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-10-11T16:03:12Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format Issues</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595805#M15859</link>
      <description>&lt;P&gt;Looks like it is doing what you asked.&amp;nbsp; Consider this little program.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   input x;
   year=year(x);
   month=month(x);
   day=day(x);
   put (_all_) (= comma12.);
cards;
01082012
04112007
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;x=1,082,012 year=4,922 month=6 day=14
x=4,112,007 year=13,218 month=4 day=20&lt;/PRE&gt;
&lt;P&gt;So one million days since 1960 is in the middle of the year 4922. 4 million days is after the start of the year 13,218!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First convert the value to an actual date (at least for the numbers that are valid dates).&amp;nbsp; Then you can use the value as a date and attach any date format you want to use when display the values.&amp;nbsp; Personally I avoid MMDDYY or DDMMYY format as whichever one you pick half of your audience will be confused.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;fixed=input(put(transaction_date,Z8.),mmddyy8.);
format fixed yymmdd10.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 16:19:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595805#M15859</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-10-11T16:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: Date Format Issues</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595823#M15862</link>
      <description>&lt;P&gt;I'd also much rather use either YYMMDDD10. or E8601DA10. as a date format. This is the internationally standardized way to write dates and leaves no ambiguity.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Oct 2019 17:02:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Date-Format-Issues/m-p/595823#M15862</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-10-11T17:02:27Z</dc:date>
    </item>
  </channel>
</rss>

