<?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: SYSDATE and SYSTIME in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273469#M54496</link>
    <description>&lt;P&gt;&lt;SPAN&gt;You can use datetime() function instead. My personal preference is to use the CATT function, I find it more readable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(datetime(), datetime21.);

data want;
long_var = catt("1234", "ABCD", put(datetime(), datetime21.));
run;

proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2016 02:48:07 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-05-27T02:48:07Z</dc:date>
    <item>
      <title>SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273460#M54490</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;I am trying to concatenate some character variables and one of those variable is SYS date and time. &lt;SPAN&gt;SYS date and time should be&amp;nbsp;YYYY-MM-DD:hh:mm:ss format.&lt;/SPAN&gt;&amp;nbsp;Can someone help me please. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code i am trying to write is like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DATA test;&lt;BR /&gt;Long_char='1234'||'ABCD'||System date and Time;&lt;BR /&gt;RUN;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Expected output:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Long_char&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;1234&lt;/SPAN&gt;&lt;SPAN&gt;ABCD2016-02-09:15:41:29&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 01:33:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273460#M54490</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-05-27T01:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273469#M54496</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You can use datetime() function instead. My personal preference is to use the CATT function, I find it more readable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%put %sysfunc(datetime(), datetime21.);

data want;
long_var = catt("1234", "ABCD", put(datetime(), datetime21.));
run;

proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 02:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273469#M54496</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-05-27T02:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273499#M54515</link>
      <description>%Let long_char=1233ABCD%sysfunc(today(),yymmdd10.):%sysfunc(time(),time.);</description>
      <pubDate>Fri, 27 May 2016 05:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273499#M54515</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-27T05:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273614#M54537</link>
      <description>Hi Reeza,&lt;BR /&gt;Thank you for the solution, but your code leave three spaces between third character and the date. Also it doesn't show (-) in between (like YYYY-MM-DD). I want it like 2016-02-09:15:41:29. can you please help further. Thanks.&lt;BR /&gt;&lt;BR /&gt;%put %sysfunc(datetime(), datetime21.);&lt;BR /&gt;&lt;BR /&gt;DATA have;&lt;BR /&gt;long_char='T1'||'12345'||'000000000000'||put(datetime(), datetime21.);&lt;BR /&gt;RUN;</description>
      <pubDate>Fri, 27 May 2016 15:28:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273614#M54537</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-05-27T15:28:14Z</dc:date>
    </item>
    <item>
      <title>Re: SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273616#M54538</link>
      <description>&lt;P&gt;Hi LinusH,&lt;BR /&gt;Thank for your code, but I don't know how to put it in the data step. Would you please put your code in the following data step so that I can get my expected result. I never worked with a let statement. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;DATA have;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;long_char='1234'||'ABCD'||SYS date and SYS time&lt;/SPAN&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;RUN;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Expected output:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;long_char=1234&lt;SPAN&gt;ABCD2016-02-09:15:41:29&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 15:32:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273616#M54538</guid>
      <dc:creator>mlogan</dc:creator>
      <dc:date>2016-05-27T15:32:26Z</dc:date>
    </item>
    <item>
      <title>Re: SYSDATE and SYSTIME</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273626#M54541</link>
      <description>Long_char="&amp;amp;long_char";</description>
      <pubDate>Fri, 27 May 2016 15:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SYSDATE-and-SYSTIME/m-p/273626#M54541</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-05-27T15:45:29Z</dc:date>
    </item>
  </channel>
</rss>

