<?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 Using a proc sql into macro with in a where statement with a list of values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779317#M248173</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code and would like to do a search on values inside the macro &amp;amp;country. which has the value of &lt;SPAN&gt;Asia, Europe, USA&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use the newly created macro in a where statement in a separate data step. How could I change the value of the macro from&amp;nbsp;&lt;SPAN&gt;Asia, Europe, USA to 'Asia', 'Europe', 'USA'&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql noprint;
 select distinct
 origin into:country separated by ", "
 from sashelp.cars
 ;
quit;

%put &amp;amp;country.;

proc sql;
 create table test_into as
 select 
 *
 from sashelp.cars
 where origin in ('&amp;amp;country.')
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Nov 2021 12:55:33 GMT</pubDate>
    <dc:creator>Adnan2</dc:creator>
    <dc:date>2021-11-09T12:55:33Z</dc:date>
    <item>
      <title>Using a proc sql into macro with in a where statement with a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779317#M248173</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code and would like to do a search on values inside the macro &amp;amp;country. which has the value of &lt;SPAN&gt;Asia, Europe, USA&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to use the newly created macro in a where statement in a separate data step. How could I change the value of the macro from&amp;nbsp;&lt;SPAN&gt;Asia, Europe, USA to 'Asia', 'Europe', 'USA'&lt;/SPAN&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc sql noprint;
 select distinct
 origin into:country separated by ", "
 from sashelp.cars
 ;
quit;

%put &amp;amp;country.;

proc sql;
 create table test_into as
 select 
 *
 from sashelp.cars
 where origin in ('&amp;amp;country.')
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many thanks in advance !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 12:55:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779317#M248173</guid>
      <dc:creator>Adnan2</dc:creator>
      <dc:date>2021-11-09T12:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Using a proc sql into macro with in a where statement with a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779318#M248174</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
 select distinct
 quote(strip(origin)) into:country separated by ", "
 from sashelp.cars
 ;
quit;

%put &amp;amp;country.;

proc sql;
 create table test_into as
 select 
 *
 from sashelp.cars
 where origin in (&amp;amp;country.)
 ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Nov 2021 12:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779318#M248174</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-11-09T12:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Using a proc sql into macro with in a where statement with a list of values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779321#M248175</link>
      <description>&lt;P&gt;Maybe i just don't understand your problem, but why do want all distinct values in a macro-variable? What is the purpose of subsequent steps?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 13:03:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Using-a-proc-sql-into-macro-with-in-a-where-statement-with-a/m-p/779321#M248175</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-11-09T13:03:16Z</dc:date>
    </item>
  </channel>
</rss>

