<?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: Can't Pass Macro List Into Where Clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591573#M169485</link>
    <description>&lt;P&gt;I would suggest dropping the commas in the list as well. The IN operator no longer requires comma separated values and there are places where commas in a macro variable, such as passing as a parameter in macro code, will cause things to break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also I would suggest that since IN requires the parentheses that code attempting to use the macro list should look like:&lt;/P&gt;
&lt;PRE&gt;where= (hcpcs in ( &amp;amp;hcpc. ) ) &lt;/PRE&gt;
&lt;P&gt;instead of placing the () in the macro value.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Sep 2019 15:12:35 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-09-25T15:12:35Z</dc:date>
    <item>
      <title>Can't Pass Macro List Into Where Clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591377#M169384</link>
      <description>&lt;P&gt;I've tried no quotes, single quotes, double quotes, etc. but can't get my hcpc macro list to work in the code below. It tells me that there was a Syntax error while parsing WHERE clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please help me fix my code, but also help me understand the general rule and what makes my first list different from my second.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;libname hcgout '/CUDM/HCG/HCG_PROD/Data_Sets/Output_NET' ;
%let list = linenum memberid memberctg incurd_yr_mo hcpcs;
%let hcpc = "E0431", "E1390", "E1392", "K0738";


data hcgTables2014toPresent ;
	set hcgout.outclaims_2014 (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.)
		hcgout.outclaims_2015 (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.)
		hcgout.outclaims_prior (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.)		
		hcgout.outclaims_current (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.);
run; &lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 04:17:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591377#M169384</guid>
      <dc:creator>acemanhattan</dc:creator>
      <dc:date>2019-09-25T04:17:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can't Pass Macro List Into Where Clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591381#M169386</link>
      <description>please try using %let hcpc = ("E0431", "E1390", "E1392", "K0738"); and let me know if it works, if it dosent, can you please attach the outclaims_2014 data set or at least an example so i could try to work on the solution</description>
      <pubDate>Wed, 25 Sep 2019 04:35:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591381#M169386</guid>
      <dc:creator>VinitvictorCorr</dc:creator>
      <dc:date>2019-09-25T04:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Can't Pass Macro List Into Where Clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591382#M169387</link>
      <description>&lt;P&gt;You need brackets around your list of hcpc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname hcgout '/CUDM/HCG/HCG_PROD/Data_Sets/Output_NET' ;
%let list = linenum memberid memberctg incurd_yr_mo hcpcs;
%let hcpc = ("E0431", "E1390", "E1392", "K0738");


data hcgTables2014toPresent ;
set hcgout.outclaims_2014 (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.)
hcgout.outclaims_2015 (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.)
hcgout.outclaims_prior (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.) 
hcgout.outclaims_current (where= (hcpcs in &amp;amp;hcpc.) keep=&amp;amp;list.);
run; &lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Sep 2019 04:38:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591382#M169387</guid>
      <dc:creator>34reqrwe</dc:creator>
      <dc:date>2019-09-25T04:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Can't Pass Macro List Into Where Clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591385#M169389</link>
      <description>&lt;P&gt;Always run the code without any macro language, and then replace values with macro variables.&lt;/P&gt;
&lt;P&gt;As it is, your syntax for the in() statement is invalid, so there is not chance of anything running.&lt;/P&gt;
&lt;P&gt;Once the syntax of hard-coded values is right, you can think about soft-coding with the macro language.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 04:57:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591385#M169389</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-09-25T04:57:51Z</dc:date>
    </item>
    <item>
      <title>Re: Can't Pass Macro List Into Where Clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591573#M169485</link>
      <description>&lt;P&gt;I would suggest dropping the commas in the list as well. The IN operator no longer requires comma separated values and there are places where commas in a macro variable, such as passing as a parameter in macro code, will cause things to break.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also I would suggest that since IN requires the parentheses that code attempting to use the macro list should look like:&lt;/P&gt;
&lt;PRE&gt;where= (hcpcs in ( &amp;amp;hcpc. ) ) &lt;/PRE&gt;
&lt;P&gt;instead of placing the () in the macro value.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 15:12:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-Pass-Macro-List-Into-Where-Clause/m-p/591573#M169485</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-09-25T15:12:35Z</dc:date>
    </item>
  </channel>
</rss>

