<?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 character format yyyymmdd to a date format ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459395#M116674</link>
    <description>It says Date is Num Type, Len 8, Format F8.</description>
    <pubDate>Wed, 02 May 2018 16:14:11 GMT</pubDate>
    <dc:creator>mkt_apprentice</dc:creator>
    <dc:date>2018-05-02T16:14:11Z</dc:date>
    <item>
      <title>How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459381#M116663</link>
      <description>&lt;P&gt;In my date, date is yyyymmdd&amp;nbsp;(for example 20081023) and I want to convert it to a date format (such as 23/10/2008) and also know which weekday. How can I do that? I read another similar post about converting and tried:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data withdate;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;date_new = input(date, yymmdd8.);&lt;BR /&gt;&amp;nbsp; &amp;nbsp;format date_new weekdate9. ;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;but it &lt;STRONG&gt;doesn't&lt;/STRONG&gt; work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Really appreciate your suggestions!&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 15:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459381#M116663</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T15:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459385#M116665</link>
      <description>&lt;P&gt;do like this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
   CharDate="20081023";
   Date=input(CharDate, yymmdd8.);
   format date date9.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 02 May 2018 16:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459385#M116665</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-05-02T16:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459386#M116666</link>
      <description>&lt;P&gt;How does it not woek? Can you provide us with a log?&lt;BR /&gt;&lt;BR /&gt;If I run your code it does work:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data withdate;
   date = '20081023';
   date_new = input(date, yymmdd8.);
   format date_new weekdate9. ;
   put _all_;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do note that I gave your variable date a value as per your question. Otherwise I can understand it doesn't work. This is the log from my code:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;1          data withdate;
2             date = '20081023';
3             date_new = input(date, yymmdd8.);
4             format date_new weekdate9. ;
5             put _all_;
6          run;

date=20081023 date_new=Thursday _ERROR_=0 _N_=1
NOTE: The data set WORK.WITHDATE has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
      real time           0.00 seconds
      cpu time            0.00 seconds
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If this doesn't clarify things for you please add your log and your desired results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:01:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459386#M116666</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2018-05-02T16:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459387#M116667</link>
      <description>&lt;P&gt;Ha same answer; we had a mid-air collision. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: changed colusion to collision. Reading too much newspapers lately &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:03:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459387#M116667</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2018-05-02T16:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459388#M116668</link>
      <description>&lt;P&gt;i think you need&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;date_new = input(date, yymmdd10.); instead of&amp;nbsp;yymmdd8.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459388#M116668</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-02T16:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459389#M116669</link>
      <description>&lt;P&gt;Great minds, you know &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:04:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459389#M116669</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-05-02T16:04:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459390#M116670</link>
      <description>Date is 20081023 so there are 8 spaces. 2008/10/23 would be a yymmdd10.</description>
      <pubDate>Wed, 02 May 2018 16:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459390#M116670</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459391#M116671</link>
      <description>Yes, 20081023 is only an example. Date is a variable. How can I change the whole variable or create a new variable to have a format of mm/dd/yyyy or show week day?</description>
      <pubDate>Wed, 02 May 2018 16:06:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459391#M116671</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:06:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459392#M116672</link>
      <description>&lt;P&gt;Is your current variable a numeric or character variable and what is the format?&lt;/P&gt;
&lt;P&gt;If you're not sure, run a PROC CONTENTS on your data set.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=sashelp.class;run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203915"&gt;@mkt_apprentice&lt;/a&gt; wrote:&lt;BR /&gt;Date is 20081023 so there are 8 spaces. 2008/10/23 would be a yymmdd10.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459392#M116672</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-02T16:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459393#M116673</link>
      <description>My log said:&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the&lt;BR /&gt;operations have been set to missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;121608 at 147:13&lt;BR /&gt;NOTE: There were 121608 observations read from the data set ORGIN.DATE.&lt;BR /&gt;NOTE: The data set ORIGIN.DATE1 has 121608 observations and 356 variables.&lt;BR /&gt;NOTE: At least one W.D format was too small for the number to be printed. The decimal may be&lt;BR /&gt;shifted by the "BEST" format.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 1.64 seconds&lt;BR /&gt;cpu time 0.87 seconds&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 02 May 2018 16:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459393#M116673</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459395#M116674</link>
      <description>It says Date is Num Type, Len 8, Format F8.</description>
      <pubDate>Wed, 02 May 2018 16:14:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459395#M116674</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:14:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459396#M116675</link>
      <description>&lt;P&gt;Then try:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_where_num;
  set have_with_num_date;
  date_new = input(put(date,8.), yymmdd8.);
  format date_new weekdate9. ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:15:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459396#M116675</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-05-02T16:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459397#M116676</link>
      <description>&lt;P&gt;Then you have a numeric value that first needs to be converted to a SAS numeric variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS stores dates as a number, which is the number of days from January 1, 1960. Then to show a formatted value a format is applied.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the simplest ways to do this is to convert the number to a character and then read it back in as a date and then apply the format.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So you would use PUT() to convert it to a character and then use INPUT() with the YYMMDD format to read it back in correctly. Then you would apply the format to have it show up the way you want.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt;&amp;nbsp;code does exactly that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:19:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459397#M116676</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-02T16:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459402#M116678</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/203915"&gt;@mkt_apprentice&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but it &lt;STRONG&gt;doesn't&lt;/STRONG&gt; work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Really appreciate your suggestions!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Generic response:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Doesn't work is awful vague.&lt;BR /&gt;&lt;BR /&gt;Are there errors in the log?: Post the code and log in a code box opened with the {i} to maintain formatting of error messages.&lt;BR /&gt;&lt;BR /&gt;No output? Post any log in a code box.&lt;BR /&gt;&lt;BR /&gt;Unexpected output? &lt;STRONG&gt;&lt;FONT color="#ff0000"&gt;Provide input data in the form of&amp;nbsp; data step code&lt;/FONT&gt;&lt;/STRONG&gt;, the actual results and the expected results. Data should be in the form of a data step. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat&lt;/A&gt;... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the highlighted text would have gotten an appropriate answer in one instead of having a back-and-forth about what you actually have to work with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the {i} icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2018 16:41:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459402#M116678</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-02T16:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459408#M116680</link>
      <description>Thank you! I not only ran it successfully but also understood the gap in my SAS understanding &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 02 May 2018 16:47:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459408#M116680</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert character format yyyymmdd to a date format ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459409#M116681</link>
      <description>It works! Thanks a lot!</description>
      <pubDate>Wed, 02 May 2018 16:48:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-convert-character-format-yyyymmdd-to-a-date-format/m-p/459409#M116681</guid>
      <dc:creator>mkt_apprentice</dc:creator>
      <dc:date>2018-05-02T16:48:38Z</dc:date>
    </item>
  </channel>
</rss>

