<?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: Write a string of the systime variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826017#M326271</link>
    <description>&lt;P&gt;The macro processor is just a text pre-processor.&amp;nbsp; It looks for the &amp;amp; and % triggers to see where it needs to take action.&lt;/P&gt;
&lt;P&gt;In your code you are only use the &amp;amp; trigger.&amp;nbsp; So the string substr is not modified by the macro processor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably want to use the macro function %SUBSTR() or&amp;nbsp; the macro function %SCAN() instead.&lt;/P&gt;
&lt;PRE&gt;555  %let dt=&amp;amp;systime;
556  %let dhour=%substr(&amp;amp;dt,1,2);
557  %let dminute=%substr(&amp;amp;dt,4,2);
558  %put &amp;amp;=systime &amp;amp;=dt &amp;amp;=dhour &amp;amp;=dminute;
SYSTIME=09:44 DT=09:44 DHOUR=09 DMINUTE=44
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jul 2022 17:36:58 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-07-28T17:36:58Z</dc:date>
    <item>
      <title>Write a string of the systime variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/825973#M326249</link>
      <description>&lt;P&gt;I have the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let dt = &amp;amp;systime;
%let dhour = substr(&amp;amp;dt.,1,2);
%let dminute = substr(&amp;amp;dt.,4,2);
%put NOTE : system data is &amp;amp;dhour. &amp;amp;dminute. ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which produced the following result:&lt;/P&gt;
&lt;P&gt;NOTE : system data is substr(10:44,1,2) substr(10:44,4,2)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The result I want is:&lt;/P&gt;
&lt;P&gt;NOTE : system data is 10 44&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you help me to correct the code?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 15:49:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/825973#M326249</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2022-07-28T15:49:26Z</dc:date>
    </item>
    <item>
      <title>Re: Write a string of the systime variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826000#M326264</link>
      <description>Since the SUBSTR() function takes a macro variable as an argument, use %SUBSTR().</description>
      <pubDate>Thu, 28 Jul 2022 16:38:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826000#M326264</guid>
      <dc:creator>svh</dc:creator>
      <dc:date>2022-07-28T16:38:48Z</dc:date>
    </item>
    <item>
      <title>Re: Write a string of the systime variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826017#M326271</link>
      <description>&lt;P&gt;The macro processor is just a text pre-processor.&amp;nbsp; It looks for the &amp;amp; and % triggers to see where it needs to take action.&lt;/P&gt;
&lt;P&gt;In your code you are only use the &amp;amp; trigger.&amp;nbsp; So the string substr is not modified by the macro processor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You probably want to use the macro function %SUBSTR() or&amp;nbsp; the macro function %SCAN() instead.&lt;/P&gt;
&lt;PRE&gt;555  %let dt=&amp;amp;systime;
556  %let dhour=%substr(&amp;amp;dt,1,2);
557  %let dminute=%substr(&amp;amp;dt,4,2);
558  %put &amp;amp;=systime &amp;amp;=dt &amp;amp;=dhour &amp;amp;=dminute;
SYSTIME=09:44 DT=09:44 DHOUR=09 DMINUTE=44
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2022 17:36:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826017#M326271</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-28T17:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Write a string of the systime variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826117#M326306</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/181543"&gt;@svh&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2022 08:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-a-string-of-the-systime-variable/m-p/826117#M326306</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2022-07-29T08:10:53Z</dc:date>
    </item>
  </channel>
</rss>

