<?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 the percent symbol at the beginning in a quotation mark mean? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730273#M227368</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation, I am wondering why the result from running the code as above contains these words, it seems to against your explanation.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Phil_NZ_0-1617147719835.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56727iB3F209E8B53AD528/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Phil_NZ_0-1617147719835.png" alt="Phil_NZ_0-1617147719835.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please correct me if I get you wrongly?&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
    <pubDate>Tue, 30 Mar 2021 23:42:25 GMT</pubDate>
    <dc:creator>Phil_NZ</dc:creator>
    <dc:date>2021-03-30T23:42:25Z</dc:date>
    <item>
      <title>What does the percent symbol at the beginning in a quotation mark mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730267#M227366</link>
      <description>&lt;P&gt;Hi all SAS Users,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Today I face a code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=pg1.np_summary;
	var Type ParkName;
	where ParkName like '%Preserve%';
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And the result is&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Phil_NZ_0-1617144399543.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56724iA003355C5874F8BD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Phil_NZ_0-1617144399543.png" alt="Phil_NZ_0-1617144399543.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I have some concerns here:&lt;/P&gt;
&lt;P&gt;1. I remember inside the single quotation, the word is sensitive, so how come it displays all uppercase in the result report? I know that the percentage symbol represents any character or blank, or else. But how do two percent symbols work in this case? And normally, to me, 'Preserve%' will display some names that should be longer than 'Preserve', so when there are some results like 'PRE' in the result, it is a bit surprising to me?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. Why when I change the single quotation to double quotation, it displayed a warning? (We all know that single and double quotation can be used interchangeably, except we must use double quotation for macro variables)&lt;/P&gt;
&lt;PRE&gt;42         proc print data=pg1.np_summary;
43         	var Type ParkName;
44         	*Add a WHERE statement;
45         	where ParkName like "'%Preserve%'";
WARNING: Apparent invocation of macro PRESERVE not resolved.
46         run;
&lt;/PRE&gt;
&lt;P&gt;Warmest regards and cheers,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 22:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730267#M227366</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-30T22:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: What does the percent symbol at the beginning in a quotation mark mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730268#M227367</link>
      <description>&lt;P&gt;The % is a wildcard for the LIKE operator.&amp;nbsp; So LIKE '%Preserve%' will match any string that contains Preserve.&amp;nbsp; Note it will not match PREserve (unless it gets pushed into some remove database that support case insensitive comparison, like Teradata).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You answered the second question yourself.&amp;nbsp; The % character is a trigger to the macro processor (the people that defined SQL and how the LIKE operator works did not take into consideration that SAS uses the % character for a different meaning).&amp;nbsp; But the macro processor ignores strings that use single quotes as the encapsulating character.&amp;nbsp; But when you switch from '%Preserve%' to "%Preverse%" the first % looks like it is a call to some macro named PRESERVE.&amp;nbsp; The macro processor will ignore the second % because the character after it cannot be the start of a macro name or macro language keyword.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that &lt;FONT face="courier new,courier"&gt;"'%Perserve%'"&lt;/FONT&gt; has two problems.&amp;nbsp; First it is bounded by double quotes so the macro processor will try to find the %PRESERVE macro.&amp;nbsp; Second the search pattern now contains the single quotes.&amp;nbsp; So it will only match values of the variable that also have single quotes on the outside.&amp;nbsp; In particular the single quotes must be in the first position and the last possible position (based on the length of the variable) so that it is not followed by of the trailing spaces that SAS uses to pad the character variable values to their fixed maximum length.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 23:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730268#M227367</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-30T23:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: What does the percent symbol at the beginning in a quotation mark mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730273#M227368</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your explanation, I am wondering why the result from running the code as above contains these words, it seems to against your explanation.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Phil_NZ_0-1617147719835.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56727iB3F209E8B53AD528/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Phil_NZ_0-1617147719835.png" alt="Phil_NZ_0-1617147719835.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Please correct me if I get you wrongly?&lt;/P&gt;
&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 23:42:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730273#M227368</guid>
      <dc:creator>Phil_NZ</dc:creator>
      <dc:date>2021-03-30T23:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: What does the percent symbol at the beginning in a quotation mark mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730274#M227369</link>
      <description>&lt;P&gt;Your program filters on ParkName not Type.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 23:54:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730274#M227369</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2021-03-30T23:54:49Z</dc:date>
    </item>
    <item>
      <title>Re: What does the percent symbol at the beginning in a quotation mark mean?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730277#M227371</link>
      <description>&lt;P&gt;Because it found the word Preserve.&amp;nbsp; Check out the green highlights.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 375px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56728i54D8A892C5FDB973/image-size/large?v=v2&amp;amp;px=999" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 00:13:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-does-the-percent-symbol-at-the-beginning-in-a-quotation/m-p/730277#M227371</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-31T00:13:45Z</dc:date>
    </item>
  </channel>
</rss>

