<?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 Concatenate Single Quote with text of a Macro Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/8073#M209</link>
    <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a macro variable dep_var as&lt;BR /&gt;
&lt;BR /&gt;
[pre] %let dep_var=yld syld myld; [/pre]&lt;BR /&gt;
I want a new macro variable as say &lt;BR /&gt;
[pre]new_dep='yld syld myld' [/pre]&lt;BR /&gt;
i.e I want to cocatenate the text of my macro variable dep_var with single quotes.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
    <pubDate>Fri, 11 Feb 2011 11:44:44 GMT</pubDate>
    <dc:creator>MKhandelwal</dc:creator>
    <dc:date>2011-02-11T11:44:44Z</dc:date>
    <item>
      <title>Concatenate Single Quote with text of a Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/8073#M209</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I have a macro variable dep_var as&lt;BR /&gt;
&lt;BR /&gt;
[pre] %let dep_var=yld syld myld; [/pre]&lt;BR /&gt;
I want a new macro variable as say &lt;BR /&gt;
[pre]new_dep='yld syld myld' [/pre]&lt;BR /&gt;
i.e I want to cocatenate the text of my macro variable dep_var with single quotes.&lt;BR /&gt;
&lt;BR /&gt;
Thanks.</description>
      <pubDate>Fri, 11 Feb 2011 11:44:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/8073#M209</guid>
      <dc:creator>MKhandelwal</dc:creator>
      <dc:date>2011-02-11T11:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Single Quote with text of a Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/8074#M210</link>
      <description>%str(%') is needed.  You may need to unquote the value, now or later.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
927  %let dep_var=yld syld myld;&lt;BR /&gt;
928  %let new_var1=%str(%')&amp;amp;dep_var.%str(%');&lt;BR /&gt;
929  %let new_var2=%unquote(%str(%')&amp;amp;dep_var.%str(%'));&lt;BR /&gt;
930&lt;BR /&gt;
931  %put _user_;&lt;BR /&gt;
GLOBAL NEW_VAR2 'yld syld myld'&lt;BR /&gt;
GLOBAL NEW_VAR1 &amp;#1;&amp;#17;&amp;#2;yld syld myld&amp;#1;&amp;#17;&amp;#2;&lt;BR /&gt;
GLOBAL DEP_VAR yld syld myld&lt;BR /&gt;
[/pre]</description>
      <pubDate>Fri, 11 Feb 2011 14:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/8074#M210</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-02-11T14:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Concatenate Single Quote with text of a Macro Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/387918#M93035</link>
      <description>&lt;P&gt;There are 2 ways to accomplish this task.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let dep_var=yld syld myld;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Method 1:&lt;/P&gt;
&lt;P&gt;%let new_var2=%unquote(%str(%'&amp;amp;dep_var%'));&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Method 2 (If running SAS 9.4 or greater):&lt;/P&gt;
&lt;P&gt;%let new_var3=%tslit(&amp;amp;dep_var);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Aug 2017 18:55:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Concatenate-Single-Quote-with-text-of-a-Macro-Variable/m-p/387918#M93035</guid>
      <dc:creator>russt_sas</dc:creator>
      <dc:date>2017-08-14T18:55:45Z</dc:date>
    </item>
  </channel>
</rss>

