<?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 converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609466#M177447</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert&amp;nbsp;converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2016-10-16T00:00:00 to 10162016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code used&lt;/P&gt;&lt;P&gt;data date1;&lt;/P&gt;&lt;P&gt;set date;&lt;/P&gt;&lt;P&gt;newdate=input(yymmdd10.);&lt;/P&gt;&lt;P&gt;format newdate mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Wed, 04 Dec 2019 18:00:52 GMT</pubDate>
    <dc:creator>heatherjae15</dc:creator>
    <dc:date>2019-12-04T18:00:52Z</dc:date>
    <item>
      <title>converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609466#M177447</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to convert&amp;nbsp;converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 2016-10-16T00:00:00 to 10162016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code used&lt;/P&gt;&lt;P&gt;data date1;&lt;/P&gt;&lt;P&gt;set date;&lt;/P&gt;&lt;P&gt;newdate=input(yymmdd10.);&lt;/P&gt;&lt;P&gt;format newdate mmddyy10.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:00:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609466#M177447</guid>
      <dc:creator>heatherjae15</dc:creator>
      <dc:date>2019-12-04T18:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609468#M177448</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;

data want;
char_date='2016-10-16T00:00:00';
want_date=input(char_date,yymmdd10.);
format want_date mmddyyn8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
want_date=input(char_date,yymmdd10.);
format want_date mmddyyn8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609468#M177448</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-04T18:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609470#M177449</link>
      <description>&lt;P&gt;Do you have a question here?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did the code you posted not work?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want to create a numeric variable with date values (number of days)?&amp;nbsp; Or another character variable?&lt;/P&gt;
&lt;P&gt;Do you want the dates to display with the mixed hyphen and underscore delimiters as in your title?&amp;nbsp; &amp;nbsp;Or would you prefer to see them with some other delimiter?&amp;nbsp; The MMDDYYx format lets you pick the delimiter by changing the letter X to one of:&amp;nbsp; BCDPS or use N and get no delimiter at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is your source variable really a character string? Or is it a datetime value with a format that makes appear in that style?&amp;nbsp; If so then just use the DATEPART() function to get the number of days from the number of seconds the variable currently has.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:23:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609470#M177449</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-04T18:23:52Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609471#M177450</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/296840"&gt;@heatherjae15&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to convert&amp;nbsp;converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example 2016-10-16T00:00:00 to 10162016&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code used&lt;/P&gt;
&lt;P&gt;data date1;&lt;/P&gt;
&lt;P&gt;set date;&lt;/P&gt;
&lt;P&gt;newdate=input(yymmdd10.);&lt;/P&gt;
&lt;P&gt;format newdate mmddyy10.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Is your variable date character or is it numeric with a format such as E8601T18. applied?&lt;/P&gt;
&lt;P&gt;If character convert as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;shows.&lt;/P&gt;
&lt;P&gt;If the variable has that E8601 (or similar ) format then the value is a DATETIME and can get the date portion with the DATEPART function:&lt;/P&gt;
&lt;PRE&gt;data date1;
   set date;
   newdate= datepart(date);
   format newdate mmddyy10.;
run;
&lt;/PRE&gt;
&lt;P&gt;you need to provide a character value to the INPUT function, either as a literal value or the name of the variable.&lt;/P&gt;
&lt;P&gt;Your data step probably threw at least one error related to the syntax of the input function.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:25:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609471#M177450</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-04T18:25:31Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609477#M177455</link>
      <description>&lt;P&gt;Thank you for replying to my question.&amp;nbsp; Unfortunately I am getting . in my new date variable.&amp;nbsp; Do you have any thoughts as to what I may have done wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:37:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609477#M177455</guid>
      <dc:creator>heatherjae15</dc:creator>
      <dc:date>2019-12-04T18:37:29Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609484#M177457</link>
      <description>&lt;P&gt;There are many.&amp;nbsp; You can help narrow the possibilities down by providing more information.&amp;nbsp; What is the name of the variable you have? Is it numeric or character?&amp;nbsp; Does if have a format attached to it? If so what format?&amp;nbsp; Did your test code generate errors or warnings? Show the log. Make sure to copy the text from the log and use the Insert Code button on the forum editor to get a pop-up window to paste the lines of text. This will prevent the forum from reflowing the text as if it was a paragraph.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 18:51:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609484#M177457</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-04T18:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: converting date YYYY-MM-DDT00:00:00 to MM-DD_YYYY</title>
      <link>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609487#M177458</link>
      <description>&lt;P&gt;If you have a true SAS datetime, you can access the date part with &lt;STRONG&gt;datepart()&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;and then re-format to mmddyyn8:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
mydate='10NOV05:03:49:19'dt;
format mydate datetime.;
run;

data want;
set have;
newdate=datepart(mydate);
format newdate mmddyyn8.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Wed, 04 Dec 2019 19:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/converting-date-YYYY-MM-DDT00-00-00-to-MM-DD-YYYY/m-p/609487#M177458</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-12-04T19:12:23Z</dc:date>
    </item>
  </channel>
</rss>

