<?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: what does it mean ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809787#M319344</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;%SUBSTR does not mask special characters or mnemonic operators in its&lt;BR /&gt;result, even when the argument was previously masked by a macro quoting function.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is saying if you use %SUBSTR() to extract part of an existing string the resulting string will not be masked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use %QSUBSTR() to extract part of an existing string the resulting string WILL have macro quoting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider this example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let unquoted=abcd,3;
%let quoted=%str(abcd,3);

%put substr(&amp;amp;unquoted,1)=%substr(&amp;amp;unquoted,1);
%put substr(&amp;amp;quoted,1)=%substr(&amp;amp;quoted,1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When the input is unquoted the ,3 is considered one of the arguments and the result is just the third character, c.&lt;/P&gt;
&lt;P&gt;When it is quoted then the ,3 is part of the string to subset and since the starting point is the first character and no length is given the result is the full string back again.&lt;/P&gt;
&lt;PRE&gt;24    %put substr(&amp;amp;unquoted,1)=%substr(&amp;amp;unquoted,1);
substr(abcd,3,1)=c
25    %put substr(&amp;amp;quoted,1)=%substr(&amp;amp;quoted,1);
substr(abcd,3,1)=abcd,3
&lt;/PRE&gt;
&lt;P&gt;But the result is no longer quoted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see this by feeding the output back into the same test:&lt;/P&gt;
&lt;PRE&gt;27    %put %substr(%substr(&amp;amp;quoted,1),1);
c
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 25 Apr 2022 22:20:04 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-04-25T22:20:04Z</dc:date>
    <item>
      <title>what does it mean ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809777#M319337</link>
      <description>&lt;P&gt;%SUBSTR does not mask special characters or mnemonic operators in its&lt;BR /&gt;result, even when the argument was previously masked by a macro quoting function.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 21:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809777#M319337</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2022-04-25T21:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: what does it mean ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809782#M319342</link>
      <description>&lt;P&gt;While not directly answering your question, a good heuristic when you have to process values of macro variables that might contain any special characters is use a DATA step (e.g. DATA _NULL_), SYMGET, ordinary DATA step string processing, and then SYMPUTX. Your life will be much easier.&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 21:46:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809782#M319342</guid>
      <dc:creator>WarrenKuhfeld</dc:creator>
      <dc:date>2022-04-25T21:46:21Z</dc:date>
    </item>
    <item>
      <title>Re: what does it mean ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809787#M319344</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/268447"&gt;@tianerhu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;%SUBSTR does not mask special characters or mnemonic operators in its&lt;BR /&gt;result, even when the argument was previously masked by a macro quoting function.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is saying if you use %SUBSTR() to extract part of an existing string the resulting string will not be masked.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use %QSUBSTR() to extract part of an existing string the resulting string WILL have macro quoting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider this example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let unquoted=abcd,3;
%let quoted=%str(abcd,3);

%put substr(&amp;amp;unquoted,1)=%substr(&amp;amp;unquoted,1);
%put substr(&amp;amp;quoted,1)=%substr(&amp;amp;quoted,1);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;When the input is unquoted the ,3 is considered one of the arguments and the result is just the third character, c.&lt;/P&gt;
&lt;P&gt;When it is quoted then the ,3 is part of the string to subset and since the starting point is the first character and no length is given the result is the full string back again.&lt;/P&gt;
&lt;PRE&gt;24    %put substr(&amp;amp;unquoted,1)=%substr(&amp;amp;unquoted,1);
substr(abcd,3,1)=c
25    %put substr(&amp;amp;quoted,1)=%substr(&amp;amp;quoted,1);
substr(abcd,3,1)=abcd,3
&lt;/PRE&gt;
&lt;P&gt;But the result is no longer quoted.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can see this by feeding the output back into the same test:&lt;/P&gt;
&lt;PRE&gt;27    %put %substr(%substr(&amp;amp;quoted,1),1);
c
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Apr 2022 22:20:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809787#M319344</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-04-25T22:20:04Z</dc:date>
    </item>
    <item>
      <title>Re: what does it mean ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809793#M319348</link>
      <description>Thank you for your help.</description>
      <pubDate>Tue, 26 Apr 2022 00:04:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809793#M319348</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2022-04-26T00:04:08Z</dc:date>
    </item>
    <item>
      <title>Re: what does it mean ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809794#M319349</link>
      <description>&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 00:04:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/what-does-it-mean/m-p/809794#M319349</guid>
      <dc:creator>tianerhu</dc:creator>
      <dc:date>2022-04-26T00:04:33Z</dc:date>
    </item>
  </channel>
</rss>

