<?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: Resolve Macro variable value in the where clause of proc sql in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487428#M127014</link>
    <description>&lt;P&gt;And what for would all this be? I have an inkling that you are aiming a big shotgun in the direction of your foot.&lt;/P&gt;</description>
    <pubDate>Thu, 16 Aug 2018 14:16:19 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2018-08-16T14:16:19Z</dc:date>
    <item>
      <title>Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487422#M127011</link>
      <description>&lt;P&gt;Team,&lt;/P&gt;&lt;P&gt;I have this dataset:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;data have1;
&amp;nbsp; &amp;nbsp; input name $23.;
&amp;nbsp; &amp;nbsp; datalines;
&amp;nbsp; &amp;nbsp; &amp;amp;temp.alpha
&amp;nbsp; &amp;nbsp; &amp;amp;temp.beta
&amp;nbsp; &amp;nbsp; ;
&amp;nbsp; &amp;nbsp; run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This is what&amp;nbsp;I want:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let temp=var1;
proc sql;
	create table want1 as
		select upcase(resolve(name)) as new_var
			from have1
				where upcase(resolve(name))=upcase("var1alpha")
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am able to get what I want using resolve().&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;But&lt;/STRONG&gt; with this, I have to make change in all the existing code.&lt;/P&gt;&lt;P&gt;I am reaching out to you to find , if any, alternative solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried having the following dataset but it does NOT work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
input name $23.;
datalines;
resolve(&amp;amp;temp.alpha)
resolve(&amp;amp;temp.beta)
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any alternative you would suggest?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:04:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487422#M127011</guid>
      <dc:creator>arpitsharma27</dc:creator>
      <dc:date>2018-08-16T14:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487428#M127014</link>
      <description>&lt;P&gt;And what for would all this be? I have an inkling that you are aiming a big shotgun in the direction of your foot.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:16:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487428#M127014</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-16T14:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487430#M127015</link>
      <description>&lt;P&gt;An example of what you have, what you want, and an explanation of the process would help.&amp;nbsp; Its unlikely that this is the best approach.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:18:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487430#M127015</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-08-16T14:18:12Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487431#M127016</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can resolve the macrovariables in a data step prior to the proc sql :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have2;
    set have1;
    name=resolve(name);
run;

proc sql;
	create table want1 as
	select upcase(name) as new_var
	from have2
	where upcase(name)=upcase("var1alpha")
	;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR class=" language-sas" /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:19:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487431#M127016</guid>
      <dc:creator>gamotte</dc:creator>
      <dc:date>2018-08-16T14:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487449#M127023</link>
      <description>&lt;P&gt;Sir,&lt;/P&gt;&lt;P&gt;With all due respect, it has been clearly laid out.&amp;nbsp;&lt;BR /&gt;You will have to run the code and read my comments in there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:39:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487449#M127023</guid>
      <dc:creator>arpitsharma27</dc:creator>
      <dc:date>2018-08-16T14:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: Resolve Macro variable value in the where clause of proc sql</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487451#M127025</link>
      <description>&lt;P&gt;I only see a dataset with one variable and one observation. Since this is no good on its own, I was asking for the bigger picture. But maybe you don't have one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To suggest an alternative (as&amp;nbsp;&lt;EM&gt;you&lt;/EM&gt; wanted in your first post), we need to know what you're aiming at.&lt;/P&gt;
&lt;P&gt;SAS will not resolve anything (no macro references, no function call, nothing) in a datalines block. And your SQL approach works, as demonstrated. But we have no idea why it would cause such a big change to existing code, as we don't see anything of that.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Aug 2018 14:54:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolve-Macro-variable-value-in-the-where-clause-of-proc-sql/m-p/487451#M127025</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-08-16T14:54:32Z</dc:date>
    </item>
  </channel>
</rss>

