<?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 in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245162#M45711</link>
    <description>&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12218i10679B1678962605/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;</description>
    <pubDate>Thu, 21 Jan 2016 12:58:46 GMT</pubDate>
    <dc:creator>vraj1</dc:creator>
    <dc:date>2016-01-21T12:58:46Z</dc:date>
    <item>
      <title>Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245135#M45695</link>
      <description>&lt;P&gt;In my dataset i have a start date with both 20150912 and 22NOV2015 formats.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do i convertthem into&amp;nbsp;&amp;nbsp;one format like 12OCT2015.&lt;/P&gt;
&lt;P&gt;The variable is in NUM and format as date9. and informat 9. with length as 4&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 11:54:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245135#M45695</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-01-21T11:54:29Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245139#M45696</link>
      <description>&lt;P&gt;Hm, do you say that you have date9. format and it still shows like YYYYMMDD? Shouldn't be possible.&lt;/P&gt;
&lt;P&gt;Please clarify with actual data (non-formatted).&lt;/P&gt;
&lt;P&gt;To convert a data from a numerical value you need to nest input() and put().&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245139#M45696</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-21T12:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245145#M45698</link>
      <description>&lt;P&gt;data looks like this as attached&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12216i11701D578D3D6943/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:21:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245145#M45698</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-01-21T12:21:32Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245149#M45701</link>
      <description>&lt;P&gt;This cannot be in SAS. To have both display methods for dates in a single column, the column must be character. Period.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:27:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245149#M45701</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-21T12:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245152#M45704</link>
      <description>&lt;P&gt;That is an Excel file correct? &amp;nbsp;You could export it to CSV and use informat anydate. &amp;nbsp;That *might* work. &amp;nbsp;However you have hit one of the big downsides to using Excel for any purpose. &amp;nbsp;It is not a database, it has no strucutre, hence you have columns with different data types. &amp;nbsp;Simple solution don't use Excel. &amp;nbsp;Here are some Excel specific answers:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://fiveminutelessons.com/learn-microsoft-excel/convert-text-value-date-excel" target="_blank"&gt;http://fiveminutelessons.com/learn-microsoft-excel/convert-text-value-date-excel&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.ablebits.com/office-addins-blog/2015/03/26/excel-convert-text-date/" target="_blank"&gt;https://www.ablebits.com/office-addins-blog/2015/03/26/excel-convert-text-date/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or, save as CSV (always move to CSV and write your own import program!) read that value in as character then post process the text into a date.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:34:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245152#M45704</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-01-21T12:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245158#M45707</link>
      <description>&lt;P&gt;I think you are in trouble, unless you have access to the original data before they were read into a numeric variable of length 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like you have indeed numeric values like 20151216, i.e. of the form YYYYMMDD. However, length 4 bytes is insufficient for integers greater than 2097152 (but sufficient for proper SAS date values). Did you notice that your YYYYMMDD values are rounded to multiples of 16? This is a logical&amp;nbsp;consequence of the insufficient length. It&amp;nbsp;leads to invalid values such as 20160096, but also the majority of valid values like 20151216 will most likely be wrong!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245158#M45707</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-21T12:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245159#M45708</link>
      <description>&lt;P&gt;No, It is in sas. i have not used csv&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:50:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245159#M45708</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-01-21T12:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245160#M45709</link>
      <description>&lt;P&gt;Do a proc contents on the data set and a proc print with obs=50, then post the results.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245160#M45709</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-21T12:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245161#M45710</link>
      <description>&lt;P&gt;Yes, i have merged 2 datasets one has date format&amp;nbsp; 20150912 and other with date9.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:54:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245161#M45710</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-01-21T12:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245162#M45711</link>
      <description>&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12218i10679B1678962605/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;</description>
      <pubDate>Thu, 21 Jan 2016 12:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245162#M45711</guid>
      <dc:creator>vraj1</dc:creator>
      <dc:date>2016-01-21T12:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245163#M45712</link>
      <description>&lt;P&gt;When I try to replicate this (setting a date-formatted variable to a YYYYMMDD value), then non-valid numbers are displayed as stars instead of the value. There must be something more at work here for SAS to use the DATE9. and the basic number format, IMO.&lt;/P&gt;
&lt;P&gt;This code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
length date 4;
format date date9.;
date = 20160096;
output;
date=today();
output;
run;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;yields this output:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;Obs&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; 1 ********* &lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp; 2 21JAN2016&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245163#M45712</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-21T13:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245166#M45713</link>
      <description>&lt;P&gt;You should convert the YYYYMMDD values to SAS date values &lt;U&gt;before&lt;/U&gt; they are stored in a variable of length 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data old;
d=20151231;
run;

data new;
set old;
d=input(put(d,8.),yymmdd8.);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To do this, you can either prepare a modified copy of the dataset with YYYYMMDD dates (see example above) and use this in&amp;nbsp;the merge step (that's the easier way), or you can perform the date conversion in the merge step itself, at least if the affected date variable is not involved in the BY statement.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:20:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245166#M45713</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-21T13:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245167#M45714</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser﻿&lt;/a&gt;: Have a look at the dataset in VIEWTABLE.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245167#M45714</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-21T13:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245169#M45715</link>
      <description>&lt;P&gt;Heh.&lt;/P&gt;
&lt;P&gt;Rarely use that any longer, as it requires starting SAS in DM mode in X-Windows directly on the server.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245169#M45715</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-21T13:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245173#M45718</link>
      <description>&lt;P&gt;I don't use VIEWTABLE either (for several reasons). I've noticed, with the "mixed" date values it writes error messages to the log (in black color!), one for each invalid value:&lt;/P&gt;
&lt;PRE&gt;ERROR: There was a problem with the format so BEST. was used.&lt;/PRE&gt;
&lt;P&gt;So, the table itself shows a mixture of BEST. and DATE9. formatted values, as shown in&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1﻿&lt;/a&gt;'s&amp;nbsp;screenshot.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 13:38:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245173#M45718</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-21T13:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245221#M45729</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/62004"&gt;@vraj1&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes, i have merged 2 datasets one has date format&amp;nbsp; 20150912 and other with date9.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;You may want to go back and remerge those data sets. Add a length statement setting the length to 8 before the SET or MERGE statement used.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jan 2016 16:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/245221#M45729</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-01-21T16:34:34Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/285455#M58365</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible with SAS to read a date from Oracle Database and write it out as format shown below.&lt;/P&gt;&lt;P&gt;30Apr2016:00:00:00&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 08:07:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/285455#M58365</guid>
      <dc:creator>moetimollo</dc:creator>
      <dc:date>2016-07-19T08:07:59Z</dc:date>
    </item>
    <item>
      <title>Re: Date format</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/285478#M58379</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't reopen old posts which have been closed. &amp;nbsp;You have a post here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/Date-format-with-the-specific-format-30Apr2016-00-00-00/m-p/285453" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/Date-format-with-the-specific-format-30Apr2016-00-00-00/m-p/285453&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;About this.&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 09:21:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Date-format/m-p/285478#M58379</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-19T09:21:22Z</dc:date>
    </item>
  </channel>
</rss>

