<?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 Difference between %scan and %qscan in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246334#M46066</link>
    <description>&lt;P&gt;May I request someone to illutsrate me the following example to understand the&amp;nbsp;difference between %scan and %qscan?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro a;
   aaaaaa
%mend a;
%macro b;
   bbbbbb
%mend b;
%macro c;
   cccccc
%mend c;

%let x=%nrstr(%a*%b*%c);
%put X: &amp;amp;x;
%put The third word in X, with SCAN: %scan(&amp;amp;x,3,*);
%put The third word in X, with QSCAN: %qscan(&amp;amp;x,3,*);


The %PUT statement writes these lines to the log: 
X: %a*%b*%c
The third word in X, with SCAN: cccccc
The third word in X, with QSCAN: %c
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I took this example from &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example citied above, I would like to understand how does %scan and %qscan function got resolved?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If X resolves to %a*%b*%c then scan function should return %c whereas it returns cccccc. Why so? Whether my underst&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jan 2016 13:18:03 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2016-01-27T13:18:03Z</dc:date>
    <item>
      <title>Difference between %scan and %qscan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246334#M46066</link>
      <description>&lt;P&gt;May I request someone to illutsrate me the following example to understand the&amp;nbsp;difference between %scan and %qscan?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro a;
   aaaaaa
%mend a;
%macro b;
   bbbbbb
%mend b;
%macro c;
   cccccc
%mend c;

%let x=%nrstr(%a*%b*%c);
%put X: &amp;amp;x;
%put The third word in X, with SCAN: %scan(&amp;amp;x,3,*);
%put The third word in X, with QSCAN: %qscan(&amp;amp;x,3,*);


The %PUT statement writes these lines to the log: 
X: %a*%b*%c
The third word in X, with SCAN: cccccc
The third word in X, with QSCAN: %c
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I took this example from &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the example citied above, I would like to understand how does %scan and %qscan function got resolved?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If X resolves to %a*%b*%c then scan function should return %c whereas it returns cccccc. Why so? Whether my underst&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 13:18:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246334#M46066</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2016-01-27T13:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between %scan and %qscan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246339#M46067</link>
      <description>&lt;P&gt;The %scan() function does not prevent the evaluation of the characters &amp;amp; and %. Therefore macro calls and variables are resolved before the scan for words is done.&lt;/P&gt;
&lt;P&gt;%qscan prevents macro evaluation, as it treats &amp;amp; and % as "normal" characters.&lt;/P&gt;
&lt;P&gt;Therefore you get what the macros resolve to with %scan, and the unresolved macro names with %qscan.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 13:47:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246339#M46067</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-01-27T13:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: Difference between %scan and %qscan</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246435#M46102</link>
      <description>%qscan is macro quoting function. 'q' is mnemonic for quoting. It treats macro triggers (&amp;amp;, %) as text. &lt;A href="http://www2.sas.com/proceedings/sugi25/25/aa/25p004.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi25/25/aa/25p004.pdf&lt;/A&gt;</description>
      <pubDate>Wed, 27 Jan 2016 20:00:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Difference-between-scan-and-qscan/m-p/246435#M46102</guid>
      <dc:creator>SAS_inquisitive</dc:creator>
      <dc:date>2016-01-27T20:00:09Z</dc:date>
    </item>
  </channel>
</rss>

