<?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 %sysfunc %str inside macro - order of processing - word scanner - macro processor in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730057#M227287</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm quoting a list of variables to process in a data step placed inside a macro.&lt;/P&gt;
&lt;P&gt;I can't figure out why I need to remove the second %str to make this step work inside a macro.&lt;/P&gt;
&lt;P&gt;Since I get&amp;nbsp;the &lt;FONT color="#993366"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ERROR: Expected close parenthesis after macro function invocation not found.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;What does the macro processor return when processing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://v8doc.sas.com/sashtml/macro/z1071824.htm" target="_blank" rel="noopener"&gt;How SAS Processes Statements with Macro Activity&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let paramcd=Alfred Louise;
%macro works();
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( )," "))")
                       ));
   run;
%mend works;
%works;

%macro doesNotWork();
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( ),%str(" ")))")
                       ));
   run;
%mend doesNotWork;
%doesNotWork;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 30 Mar 2021 11:15:53 GMT</pubDate>
    <dc:creator>Oligolas</dc:creator>
    <dc:date>2021-03-30T11:15:53Z</dc:date>
    <item>
      <title>%sysfunc %str inside macro - order of processing - word scanner - macro processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730057#M227287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm quoting a list of variables to process in a data step placed inside a macro.&lt;/P&gt;
&lt;P&gt;I can't figure out why I need to remove the second %str to make this step work inside a macro.&lt;/P&gt;
&lt;P&gt;Since I get&amp;nbsp;the &lt;FONT color="#993366"&gt;&lt;STRONG&gt;&lt;FONT face="courier new,courier"&gt;ERROR: Expected close parenthesis after macro function invocation not found.&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;What does the macro processor return when processing?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://v8doc.sas.com/sashtml/macro/z1071824.htm" target="_blank" rel="noopener"&gt;How SAS Processes Statements with Macro Activity&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let paramcd=Alfred Louise;
%macro works();
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( )," "))")
                       ));
   run;
%mend works;
%works;

%macro doesNotWork();
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( ),%str(" ")))")
                       ));
   run;
%mend doesNotWork;
%doesNotWork;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 30 Mar 2021 11:15:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730057#M227287</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-03-30T11:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc %str inside macro - order of processing - word scanner - macro processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730061#M227289</link>
      <description>&lt;P&gt;Using quotes or double-quotes as text can get tricky inside the macro processor. You need to indicate that these are considered unmatched double-quotes, by using %" rather than just ". Now both macros work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let paramcd=Alfred Louise;

%macro works;
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( )," "))")  ));
   run;
%mend works;
%works

%macro doesNotWork;
   data want;
      set sashelp.class(where=(Name in ("%sysfunc(tranwrd(%sysfunc(compbl(&amp;amp;paramcd.)),%str( ),%str(%" %")))")
                       ));
   run;
%mend doesNotWork;
%doesNotWork&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 13:21:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730061#M227289</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-30T13:21:10Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc %str inside macro - order of processing - word scanner - macro processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730091#M227296</link>
      <description>&lt;P&gt;Why did you add the %STR() to quote something that does not need quoting?&amp;nbsp; To include quotes in %STR() you need to escape them with %.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 13:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730091#M227296</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-03-30T13:50:44Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc %str inside macro - order of processing - word scanner - macro processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730167#M227334</link>
      <description>&lt;P&gt;you're both right&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; I sometimes pass special characters through %STR in other context and didn't expect SAS to crash here.&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;I'd expect SAS to recognize that the quotes inside %STR are matched?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 18:22:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730167#M227334</guid>
      <dc:creator>Oligolas</dc:creator>
      <dc:date>2021-03-30T18:22:33Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc %str inside macro - order of processing - word scanner - macro processor</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730169#M227336</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/77163"&gt;@Oligolas&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;you're both right&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;I'd expect SAS to recognize that the quotes inside %STR are matched?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And yet, it doesn't, because the quotes are not matched. Matched quotes indicate that what is between them is quoted, &lt;EM&gt;i.e.&lt;/EM&gt; is a text string. You have a need for a double-quote character at the end of a text string, followed by a space, followed by a double-quote character to start another text string. You are not trying to quote the text between them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As Tom says, you are passing the the %STR function text that doesn't have characters that need %STR. And so the interpretation is different.&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 18:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-str-inside-macro-order-of-processing-word-scanner-macro/m-p/730169#M227336</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-03-30T18:31:57Z</dc:date>
    </item>
  </channel>
</rss>

