<?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: SAS Macro %substr in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386247#M277194</link>
    <description>&lt;P&gt;Thank &amp;nbsp;you that works&lt;/P&gt;</description>
    <pubDate>Tue, 08 Aug 2017 13:15:55 GMT</pubDate>
    <dc:creator>PSIOT</dc:creator>
    <dc:date>2017-08-08T13:15:55Z</dc:date>
    <item>
      <title>SAS Macro %substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386190#M277191</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I try to keep only the first 11 character from string with carriage return.&lt;/P&gt;&lt;P&gt;ex:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"In progress. # 1 DCF[ CLOSED ] 02/03/2017 15:46Mr A. ADJE wrote null.and proposed value 999,999,999. 30/06/2017 11:10Mme&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;M. CANEAU wrote ok.and proposed value null. # 1 Notification. Change performed by Mme M. CANEAU on 30/06/2017 11:10 :ok-new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;value: null"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Please find my sentence in my macro:&lt;/P&gt;&lt;P&gt;%let fileDel2=%unquote(%sysfunc(getvarc(&amp;amp;tabid2,%sysfunc(varnum(&amp;amp;tabid2,&amp;amp;nomvar2)))));&amp;nbsp;&lt;BR /&gt;%put &amp;amp;fileDel2;&amp;nbsp;&lt;BR /&gt;%let nou=%substr(&amp;amp;fileDel2,1,11);&lt;BR /&gt;%put &amp;amp;nou;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log displays:&lt;BR /&gt;In progress. # 1 DCF[ CLOSED ] 02/03/2017 15:46Mr A. ADJE wrote null.and proposed value 999,999,999. 30/06/2017 11:10Mme&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;M. CANEAU wrote ok.and proposed value null. # 1 Notification. Change performed by Mme M. CANEAU on 30/06/2017 11:10 : ok - new&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;value: null&lt;BR /&gt;ERROR: Macro function %SUBSTR has too many arguments.&lt;BR /&gt;ERROR: The macro KEEPMONITORTAB will stop executing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i perform directly on table without macro, it works.&lt;/P&gt;&lt;P&gt;What can I do for that works also throught macro?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 08:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386190#M277191</guid>
      <dc:creator>PSIOT</dc:creator>
      <dc:date>2017-08-08T08:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386192#M277192</link>
      <description>&lt;P&gt;Simple answer: don't do it. Macro language is for the creation of dynamic code, not for manipulating data.&lt;/P&gt;
&lt;P&gt;An abomination like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let fileDel2=%unquote(%sysfunc(getvarc(&amp;amp;tabid2,%sysfunc(varnum(&amp;amp;tabid2,&amp;amp;nomvar2)))));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is the consequence of trying to abuse the macro processor.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 08:33:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386192#M277192</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-08T08:33:26Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386215#M277193</link>
      <description>&lt;P&gt;You can probably (can't get it right now) get away with this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let nou&amp;nbsp;= %unquote( %substr(%superq(fileDel2), 1, 11) ) ;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Most likely, the problems occur because of the commas within the value of &amp;amp;fileDel2. &amp;nbsp;%SUBSTR interprets them as marking the end of one parameter and the beginning of the next.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 11:27:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386215#M277193</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-08T11:27:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Macro %substr</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386247#M277194</link>
      <description>&lt;P&gt;Thank &amp;nbsp;you that works&lt;/P&gt;</description>
      <pubDate>Tue, 08 Aug 2017 13:15:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Macro-substr/m-p/386247#M277194</guid>
      <dc:creator>PSIOT</dc:creator>
      <dc:date>2017-08-08T13:15:55Z</dc:date>
    </item>
  </channel>
</rss>

