<?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: Concat Date and Time in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466172#M70608</link>
    <description>&lt;P&gt;Are you dates and time char or numeric?&lt;/P&gt;</description>
    <pubDate>Wed, 30 May 2018 18:17:02 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2018-05-30T18:17:02Z</dc:date>
    <item>
      <title>Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466157#M70605</link>
      <description>&lt;P&gt;Hi, I need to concat Date and Time using proc sql&lt;/P&gt;&lt;P&gt;Date&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;15/05/2018&lt;/P&gt;&lt;P&gt;Time&lt;/P&gt;&lt;P&gt;8:27:30&lt;/P&gt;&lt;P&gt;DateTime&lt;/P&gt;&lt;P&gt;15/05/2018 08:27:30&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I did that: &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;cat(put(day(Date),z2.),'/',put(month(Date),z2.),'/',year(Date),' ',put(hour(Time),z2.),':',put(minute(Time),z2.),":",put(second(Time),z2.)) as DateTime&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone can show me another way please one that I don’t mess with the column format&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 18:06:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466157#M70605</guid>
      <dc:creator>godoyau</dc:creator>
      <dc:date>2018-05-30T18:06:00Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466162#M70607</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_var = dhms(date, 0, 0, time);

format new_var datetime.;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This may be helpful.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&amp;nbsp;" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Working-with-Dates-and-Times-in-SAS-Tutorial/ta-p/424354&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 18:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466162#M70607</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-05-30T18:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466172#M70608</link>
      <description>&lt;P&gt;Are you dates and time char or numeric?&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 18:17:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466172#M70608</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-05-30T18:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466176#M70609</link>
      <description>&lt;P&gt;Numeric&lt;/P&gt;</description>
      <pubDate>Wed, 30 May 2018 18:20:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466176#M70609</guid>
      <dc:creator>godoyau</dc:creator>
      <dc:date>2018-05-30T18:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466180#M70612</link>
      <description>Ok it works, but i need this format 15/05/18:08:27:30 and datetime. returns 15MAY18:08:27:30.</description>
      <pubDate>Wed, 30 May 2018 18:25:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466180#M70612</guid>
      <dc:creator>godoyau</dc:creator>
      <dc:date>2018-05-30T18:25:21Z</dc:date>
    </item>
    <item>
      <title>Re: Concat Date and Time</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466219#M70615</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212817"&gt;@godoyau&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ok it works, but i need this format 15/05/18:08:27:30 and datetime. returns 15MAY18:08:27:30.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The value appears correct, what you are actually saying is that the display format does not meet you expectation/ need.&lt;/P&gt;
&lt;P&gt;SAS provides a very large number of date, time and datetime display formats but cannot meet every single need. However you can create custom display format using Proc format with the Picture statement and directives. Warning for the code below: The quotes around the funny list of %0d/%0m/0%y:%0H:%0M:%0S must be single quotes or else SAS will think you are using macro variables. The case on the d m y H M and S are significant. Changing from 'm' to 'M' for instance will change the displayed value from month number to Minutes (and vice versa). The 0 are to display leading zeroes for values less than 10. Since this is not SAS supplied format it will be up to you to make sure the format is available when ever you need to use it. Either rerun the code every session or add the format to permanent format catalog.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
picture mydttime
low - high= '%0d/%0m/0%y:%0H:%0M:%0S' (datatype=datetime)
;
run; 

data junk;
   x='15MAY18:08:27:30'dt;
   put x= mydttime.;
run;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 May 2018 19:50:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Concat-Date-and-Time/m-p/466219#M70615</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-30T19:50:31Z</dc:date>
    </item>
  </channel>
</rss>

