<?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: Convert SAS Date character and format it in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313662#M61512</link>
    <description>&lt;P&gt;You can use string functions with the standard formats if you really want this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otheriwse if you have flexibility using a standard format is definitely easier. Note that when this is char you can aggregate or expect it to sort correctly at all. Picking something that sorts properly may not be a bad idea.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Functions&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATEPART, TIMEPART to convert or components&lt;/P&gt;
&lt;P&gt;Day, Month, Year () respectively extract the&amp;nbsp;&amp;nbsp;names components.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats:&lt;/P&gt;
&lt;P&gt;DOWNAME3 -&amp;gt; Mon, Tue, Wed, etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wordatex. -&amp;gt; 5 March 2016 (if you want the 3 char month try specifying a length of 11. Not sure if it will work)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MONNAME3 -&amp;gt; 3 character month, Jan, Feb, Mar, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the time, TIMEAMPM7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use CATX() to combine components.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the ingredients are there, some assembly required &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2016 05:15:38 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-11-23T05:15:38Z</dc:date>
    <item>
      <title>Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313600#M61495</link>
      <description>&lt;P&gt;In SAS EG I am attempting to convert datetime() to a string in a particular format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know how to convert to a string -&lt;/P&gt;&lt;P&gt;put(datepart(datetime()),***)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like it to be formatted&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ddd, dd mmm yyyy, hh:mm AM/PM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (how I would be formattted in Excel)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wed, 23 Nov 2016, 09:30 AM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What do i use in *** to get it to display like this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(I am not wanting to use a SAS Date - I will never want this field for any calculations).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 21:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313600#M61495</guid>
      <dc:creator>juliamorgan</dc:creator>
      <dc:date>2016-11-22T21:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313601#M61496</link>
      <description>I don't know what exactly happen when exporting to Excel. &lt;BR /&gt;But you are asking for some sort of timestamp, so you shouldn't use datepart.&lt;BR /&gt;I suggest that you explore the different datetime formats and start from there.</description>
      <pubDate>Tue, 22 Nov 2016 21:22:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313601#M61496</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-11-22T21:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313604#M61497</link>
      <description>&lt;P&gt;It has nothing to do with Excel or exporting&amp;nbsp;- I was&amp;nbsp;using&amp;nbsp;it as an example of how I would format in&amp;nbsp;Excel to show the format that I wanted (30 seconds to&amp;nbsp;do a custom date format in Excel).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have spent around a good couple of hours&amp;nbsp;going through the various formats - there is nothing there that will do this. And then several more hours trying to work out how to convert to a string in the required format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am creating my queries / tables in EG, then using those tables in VA.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;VA will ignore any formats applied to dates in the tables created in EG and does not have the formatting that I require.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Therefore, the only&amp;nbsp;way that I can see to do this, is to&amp;nbsp;create, from datetime() a formatted string in EG.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I want a timestamp (which is exactly what I want) what should I use instead?&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;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 21:28:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313604#M61497</guid>
      <dc:creator>juliamorgan</dc:creator>
      <dc:date>2016-11-22T21:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313610#M61499</link>
      <description>&lt;P&gt;Create your own format by:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format lib=work;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;picture myfmt&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;other = "%a, %0d %b %Y, %h:%m %p" (datatype=datetime);&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;/* test */&lt;/P&gt;
&lt;P&gt;data _NULL_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dt = datetime();&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; put dt= myfmt30.;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 22:04:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313610#M61499</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-11-22T22:04:00Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313615#M61502</link>
      <description>&lt;P&gt;Well, as noted there isn't a standard format so you can create your own using a proc format and picture statement.&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/88384"&gt;@Shmuel﻿&lt;/a&gt;&amp;nbsp;code provides the correct format you requested.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can get a quick little overview here, if desired:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www2.sas.com/proceedings/forum2008/168-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/168-2008.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you run the proc format in EG, you can then apply it with the PUT statement.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 22:21:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313615#M61502</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-22T22:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313623#M61503</link>
      <description>&lt;P&gt;Thanks everyone, creating a format would be almost there but the issue with this is that the format will be just for me - adds complications when it comes to getting this loaded into the production environment. Guess I'll just have to admit defeat and use a format that I don't want.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 00:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313623#M61503</guid>
      <dc:creator>juliamorgan</dc:creator>
      <dc:date>2016-11-23T00:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313632#M61507</link>
      <description>&lt;P&gt;It is easy to make the format available to any one in the company, who uses &lt;STRONG&gt;same sas server or instalation&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;You just need change&amp;nbsp;the library from&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;proc format&lt;STRONG&gt; lib=work;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;to a &lt;U&gt;common library&lt;/U&gt;, what ever its name.&lt;/P&gt;
&lt;P&gt;The other benefit will be that you&lt;STRONG&gt; run that proc format once only&lt;/STRONG&gt;, no need to atach it to your program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 01:54:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313632#M61507</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-11-23T01:54:53Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313633#M61508</link>
      <description>&lt;P&gt;Thanks - however I don't have permission to use any library in UAT or production (only development). Someone else said that it was hard to get theirs added due to internal procedures etc&amp;nbsp;- so it really isn't worth the fight - thought it would be a two minute job - an entire day later - the available formats will have to be used.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 01:58:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313633#M61508</guid>
      <dc:creator>juliamorgan</dc:creator>
      <dc:date>2016-11-23T01:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Convert SAS Date character and format it</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313662#M61512</link>
      <description>&lt;P&gt;You can use string functions with the standard formats if you really want this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otheriwse if you have flexibility using a standard format is definitely easier. Note that when this is char you can aggregate or expect it to sort correctly at all. Picking something that sorts properly may not be a bad idea.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Functions&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATEPART, TIMEPART to convert or components&lt;/P&gt;
&lt;P&gt;Day, Month, Year () respectively extract the&amp;nbsp;&amp;nbsp;names components.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Formats:&lt;/P&gt;
&lt;P&gt;DOWNAME3 -&amp;gt; Mon, Tue, Wed, etc&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;wordatex. -&amp;gt; 5 March 2016 (if you want the 3 char month try specifying a length of 11. Not sure if it will work)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MONNAME3 -&amp;gt; 3 character month, Jan, Feb, Mar, etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the time, TIMEAMPM7.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use CATX() to combine components.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All the ingredients are there, some assembly required &lt;span class="lia-unicode-emoji" title=":grinning_face_with_smiling_eyes:"&gt;😄&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2016 05:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Convert-SAS-Date-character-and-format-it/m-p/313662#M61512</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-11-23T05:15:38Z</dc:date>
    </item>
  </channel>
</rss>

