<?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: Transform macro variable to wrap &amp;quot; &amp;quot; around words within in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364568#M86474</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129266"&gt;@Jamie_H&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I believe for what you're after it would be much easier to use the IN operator with a column modifier.&lt;/P&gt;
&lt;P&gt;Below code illustrates what I'm talking about.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let clause2 = alf ,ali;

%let clause2Quotes=%sysfunc( prxchange(s/([^\s,]+)/"\1"/,-1,%nrbquote(&amp;amp;clause2)) );

%put clause2Quotes:         %nrbquote(&amp;amp;clause2Quotes);

proc print data=sashelp.class;
  where upcase(name) in: %upcase((&amp;amp;clause2Quotes))
  ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Jun 2017 13:16:21 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2017-06-06T13:16:21Z</dc:date>
    <item>
      <title>Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363490#M86088</link>
      <description>&lt;P&gt;I have a macro variable that holds a string.&amp;nbsp; The string is&amp;nbsp;a clause that will be used in a procedure,&amp;nbsp;eg; where x = &amp;amp;clause.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The string&amp;nbsp;can hold one or many&amp;nbsp;clauses:&lt;/P&gt;&lt;P&gt;Example 1 &amp;amp;clause. = Company&amp;nbsp;A&lt;/P&gt;&lt;P&gt;Example 2 &amp;amp;clause. = Company A, Company B, Company C&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone know how I can transform the macro variable to wrap quotes around each of the clauses, so I end up with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example 1 &amp;amp;clause. = "Company A"&lt;/P&gt;&lt;P&gt;Example 2 &amp;amp;clause. = "Company&amp;nbsp;A", "Company B", "Company C"&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:00:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363490#M86088</guid>
      <dc:creator>Jamie_H</dc:creator>
      <dc:date>2017-06-01T16:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363496#M86089</link>
      <description>&lt;P&gt;If you are assigning the value in a %let statement, you can simply use the statement below:&lt;/P&gt;&lt;PRE&gt;%let clause = "Company A", "Company B", "Company C" ;&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:09:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363496#M86089</guid>
      <dc:creator>Gireesh</dc:creator>
      <dc:date>2017-06-01T16:09:18Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363500#M86090</link>
      <description>&lt;P&gt;You should be able to make the transition just using the TRANWRD() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let list=Company A,Company B,Company C;
%let clause = "%sysfunc(tranwrd(%superq(list),%str(,),%str(",")))" ;
%put &amp;amp;=list &amp;amp;=clause;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Note that if you have spaces around your delimiter (commas in this example) that the spaces will become part of the quoted strings. Also note that using comma as your delimiter make it harder. You need to quote the commas in the source string so that TRANWRD() doesn't see too many words and quote the comma in the second argument to the TRANWRD() function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You also need to worry about there being embedded delimiters into your string. &amp;nbsp;If that can happen then you probably need to use a more complex program that could use the modifiers of the SCAN() function to allow quoted strings to mask embedded delimiters.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363500#M86090</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-06-01T16:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363507#M86093</link>
      <description>&lt;P&gt;Hi Jamie_H&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think this macro, which can be used as a function, does whar you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let clause1 = Company A;&lt;/P&gt;
&lt;P&gt;%let clause2 = Company A, Company B, Company C;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; m(arg);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %local clause wclause;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let ccnt = %eval(%sysfunc(countw(&amp;amp;arg,',')));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %do i = &lt;STRONG&gt;1&lt;/STRONG&gt; %to &amp;amp;ccnt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let wclause = %scan(&amp;amp;arg,&amp;amp;i,%str(,));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let wclause = "&amp;amp;wclause";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %if &amp;amp;i &amp;lt; &amp;amp;ccnt %then %let wclause = %quote(&amp;amp;wclause%str(,));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let clause = &amp;amp;clause &amp;amp;wclause;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;clause&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let clause2 = %quote(%m(%quote(&amp;amp;clause2)));&lt;/P&gt;
&lt;P&gt;%put &amp;amp;clause2;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:34:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363507#M86093</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2017-06-01T16:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363513#M86097</link>
      <description>&lt;P&gt;You may try next code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _NULL_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; clause = tranw( "&amp;amp;clause" , ',' , '","'); &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;call symput('clause','"'||claus||'"');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pay attention: &amp;nbsp; '"' is: single-double-single quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Jun 2017 16:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363513#M86097</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2017-06-01T16:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363755#M86173</link>
      <description>&lt;P&gt;Hi ErikLund,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Many thanks for this, it works perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a quick secondary question.&amp;nbsp; For a couple of variants, I need to adopt the code to include a "%" for a wildcard, so&lt;/P&gt;&lt;P&gt;%let clause2 = Company A, Company B, Company C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;becomes&lt;/P&gt;&lt;P&gt;clause2 = "Company A%", "Company B%", "Company C%"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've tried playing with the code to insert this in a relevant place, but keep getting errors such as my quotes are uneven.&amp;nbsp; I'm guessing it is because a % is a special character and needs to be treated with care.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Any thoughts?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 11:13:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363755#M86173</guid>
      <dc:creator>Jamie_H</dc:creator>
      <dc:date>2017-06-02T11:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363962#M86252</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129266"&gt;@Jamie_H&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi ErikLund,&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Many thanks for this, it works perfectly.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Just a quick secondary question.&amp;nbsp; For a couple of variants, I need to adopt the code to include a "%" for a wildcard, so&lt;/P&gt;
&lt;P&gt;%let clause2 = Company A, Company B, Company C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;becomes&lt;/P&gt;
&lt;P&gt;clause2 = "Company A%", "Company B%", "Company C%"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've tried playing with the code to insert this in a relevant place, but keep getting errors such as my quotes are uneven.&amp;nbsp; I'm guessing it is because a % is a special character and needs to be treated with care.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Any thoughts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You should show the code where you are using that Clause2. Depending on how you are using it there are likely different approaches needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW I have had very few good results over the years when including quotes in the values of macro variables.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jun 2017 23:16:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363962#M86252</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-06-02T23:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363978#M86257</link>
      <description>&lt;P&gt;I'n a fan of Richard DeVenzia's utility macro %seplist.&amp;nbsp; It's very useful for taking a list, and adding or removind delimiters, quotes, etc.&amp;nbsp; You can download it from: &lt;A href="http://www.devenezia.com/downloads/sas/macros/index.php?m=seplist" target="_blank"&gt;http://www.devenezia.com/downloads/sas/macros/index.php?m=seplist&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For your two examples, you can use like:&lt;/P&gt;
&lt;PRE&gt;175  %let clause=Company A,Company B,Company C;
176
177  %put %seplist(%bquote(&amp;amp;clause),indlm=%str(,),dlm=%str(, ),nest=QQ);
"Company A", "Company B", "Company C"
178
179  %put %seplist(%bquote(&amp;amp;clause),indlm=%str(,),dlm=%str(, ),prefix=%str(%"),suffix=%str(%%%"));
"Company A%", "Company B%", "Company C%"
&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Jun 2017 01:12:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/363978#M86257</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-06-03T01:12:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364552#M86469</link>
      <description>&lt;P&gt;Many thanks for your continued help Erik and Quentin.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I love that macro to separate out strings Quentin, and i'm sure that is going to prove incredibly useful to me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final issue i'm having, is that the string with the wildcard % needs to be used in a as a LIKE in a Where clause of a Proc Sort.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use that macro to create the correct text, it gives me a syntax error.&amp;nbsp;&amp;nbsp; The Macro variable itself resolves to a correct state - that being I can copy and paste the resolved text into the same Proc Sort and it will work.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code looks like this, with the error message afterwards.&amp;nbsp; Any suggestions?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%Let clause2 = COMPANYA,COMPANYB&lt;/P&gt;&lt;P&gt;%let clause2&amp;nbsp; = %seplist(%bquote(&amp;amp;clause2),indlm=%str(,),dlm=%str( or upcase(RetailerCode) like ),prefix=%str(%"),suffix=%str(%%%"));&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sort data=Have out= Want nodupkey;&lt;BR /&gt;by variable_a;&lt;/P&gt;&lt;P&gt;where upcase(RetailerCode) like&lt;/P&gt;&lt;P&gt;&amp;amp;Clause2.&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;--------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;LOG OUTPUT&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;22&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where upcase(RetailerCode) like&lt;BR /&gt;23&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;clause2.&lt;BR /&gt;25&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;BR /&gt;NOTE: Line generated by the macro variable "Clause2".&lt;BR /&gt;26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "COMPANYA%" or upcase(RetailerCode) like "COMPANYB%"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 76&lt;BR /&gt;ERROR: Syntax error while parsing WHERE clause.&lt;BR /&gt;ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; a missing value, (, +, -, INPUT, NOT, PUT, ^, ~.&amp;nbsp;&lt;BR /&gt;ERROR 76-322: Syntax error, statement will be ignored.&lt;BR /&gt;27&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 12:32:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364552#M86469</guid>
      <dc:creator>Jamie_H</dc:creator>
      <dc:date>2017-06-06T12:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364568#M86474</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/129266"&gt;@Jamie_H&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;I believe for what you're after it would be much easier to use the IN operator with a column modifier.&lt;/P&gt;
&lt;P&gt;Below code illustrates what I'm talking about.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let clause2 = alf ,ali;

%let clause2Quotes=%sysfunc( prxchange(s/([^\s,]+)/"\1"/,-1,%nrbquote(&amp;amp;clause2)) );

%put clause2Quotes:         %nrbquote(&amp;amp;clause2Quotes);

proc print data=sashelp.class;
  where upcase(name) in: %upcase((&amp;amp;clause2Quotes))
  ;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Jun 2017 13:16:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364568#M86474</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2017-06-06T13:16:21Z</dc:date>
    </item>
    <item>
      <title>Re: Transform macro variable to wrap " " around words within</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364572#M86477</link>
      <description>&lt;P&gt;In the end of the macro definition where it returns the value:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;amp;emit&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Try changing it to:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%unquote(&amp;amp;emit)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are known problems&amp;nbsp;in the macro language&amp;nbsp;where macro quoting is not automatically removed.&amp;nbsp; In the setting you describe (MPRINT code looks correct and can even cut-and-paste from the log and run it), always try %unquoting().&lt;/P&gt;</description>
      <pubDate>Tue, 06 Jun 2017 13:27:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Transform-macro-variable-to-wrap-quot-quot-around-words-within/m-p/364572#M86477</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2017-06-06T13:27:18Z</dc:date>
    </item>
  </channel>
</rss>

