<?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: How to resolve macro variable with quotes? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629271#M186060</link>
    <description>Thank you for your warning. Actually memname and libname vars are uppercase in my real code, i just changed in sample code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
    <pubDate>Tue, 03 Mar 2020 20:43:07 GMT</pubDate>
    <dc:creator>maozsoy</dc:creator>
    <dc:date>2020-03-03T20:43:07Z</dc:date>
    <item>
      <title>How to resolve macro variable with quotes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629138#M186008</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'am using SAS EG 7.3. I am trying to resolve a macro&amp;nbsp;variable but i didn't. How can i do this? I am trying different two format.&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* method-1 */

proc sql noprint;
	select 	count(distinct(name))  into: abc
	from 	dictionary.columns
	where
	libname = 'aaa' and  memname = "%str(%'bbb_&amp;amp;M0.%')" ;
quit;

/* method-2 */

proc sql noprint;
	select 	count(distinct(name))  into: abc
	from 	dictionary.columns
	where
	libname = 'aaa' and  memname = 'bbb_&amp;amp;M0.';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Mar 2020 15:00:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629138#M186008</guid>
      <dc:creator>maozsoy</dc:creator>
      <dc:date>2020-03-03T15:00:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve macro variable with quotes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629142#M186011</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
	select 	count(distinct(name))  into: abc
	from 	dictionary.columns
	where
	libname = 'aaa' and  memname = "bbb_&amp;amp;M0.";
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Bart&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 15:11:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629142#M186011</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2020-03-03T15:11:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve macro variable with quotes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629150#M186017</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/293869"&gt;@maozsoy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'am using SAS EG 7.3. I am trying to resolve a macro&amp;nbsp;variable but i didn't. How can i do this? I am trying different two format.&lt;/P&gt;
&lt;P&gt;Thank you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* method-1 */

proc sql noprint;
	select 	count(distinct(name))  into: abc
	from 	dictionary.columns
	where
	libname = 'aaa' and  memname = "%str(%'bbb_&amp;amp;M0.%')" ;
quit;

/* method-2 */

proc sql noprint;
	select 	count(distinct(name))  into: abc
	from 	dictionary.columns
	where
	libname = 'aaa' and  memname = 'bbb_&amp;amp;M0.';
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;macro variable values between single quotes do not resolve. So your memname='bbb_&amp;amp;M0.' will not resolve the value.&lt;/P&gt;
&lt;P&gt;A quick example:&lt;/P&gt;
&lt;PRE&gt;%let macv = sometext;

%put '&amp;amp;macv.';
%put "&amp;amp;macv.";&lt;/PRE&gt;
&lt;P&gt;The Log will show the second put with the macro variable resolved.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 15:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629150#M186017</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-03-03T15:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve macro variable with quotes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629237#M186044</link>
      <description>&lt;P&gt;Note that even if you get your macro variables to resolve by using double quotes instead of single quotes, your query will not find any matches.&amp;nbsp; The MEMNAME and LIBNAME values into the DICTIONARY tables (views) are uppercase only.&amp;nbsp; So you can never match 'aaa'.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Mar 2020 19:46:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629237#M186044</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-03-03T19:46:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to resolve macro variable with quotes?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629271#M186060</link>
      <description>Thank you for your warning. Actually memname and libname vars are uppercase in my real code, i just changed in sample code &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Tue, 03 Mar 2020 20:43:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-resolve-macro-variable-with-quotes/m-p/629271#M186060</guid>
      <dc:creator>maozsoy</dc:creator>
      <dc:date>2020-03-03T20:43:07Z</dc:date>
    </item>
  </channel>
</rss>

