<?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: Creating a macro list in PROC SQL using results from EXCEPT in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548834#M152246</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/66894"&gt;@nd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not clear what you want. Is it a list of variable names or variable values?, and how should they be separated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide example data for new and old data sets and the expected output (macro variable value)&lt;/P&gt;</description>
    <pubDate>Fri, 05 Apr 2019 17:03:49 GMT</pubDate>
    <dc:creator>ErikLund_Jensen</dc:creator>
    <dc:date>2019-04-05T17:03:49Z</dc:date>
    <item>
      <title>Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548825#M152241</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;I want to create macro list of variables that contains variables are in the NEW dataset only. NEW and OLD only contain the variable "name," generated from proc contents output.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
select * into :varlist separated " " 
from  new
except  
select * from old;
quit;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If I omit "into :varlist separated " " " I get the list of unique variables in NEW. Using SAS 9.4. Thanks all!&amp;nbsp;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 16:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548825#M152241</guid>
      <dc:creator>nd</dc:creator>
      <dc:date>2019-04-05T16:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548829#M152242</link>
      <description>&lt;P&gt;You have missed &lt;STRONG&gt;EXCEPT ALL&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;sql&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;into&lt;/SPAN&gt; :varlist separated &lt;SPAN class="token string"&gt;" "&lt;/SPAN&gt; 
&lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt;  new
&lt;SPAN class="token number"&gt;ex&lt;/SPAN&gt;cept  all
&lt;SPAN class="token statement"&gt;select&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;from&lt;/SPAN&gt; old&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 16:58:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548829#M152242</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-05T16:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548831#M152243</link>
      <description>&lt;P&gt;You cannot select * into a macro variable. You can only select a single expression.&lt;/P&gt;
&lt;P&gt;You can only use INTO on the outer most query.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select name into :namelist separated by ' '
from 
(select name from new
  except
  select name from old
)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 05 Apr 2019 16:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548831#M152243</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-05T16:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548832#M152244</link>
      <description>&lt;P&gt;A fun test:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data new;
input a;
cards;
1
2
3
3
4
4
5
;

data old;
input a;
cards;
1
2
5
;

proc sql ;
select * into :varlist separated " " 
from 
(select *
from  new
except  all
select * from old);
quit;

%put &amp;amp;varlist;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;Results:&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt; %put &amp;amp;varlist;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;3 3 4 4&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Either way, Please be &lt;STRONG&gt;advised&lt;/STRONG&gt; &lt;STRONG&gt;not to use *&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 17:01:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548832#M152244</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-04-05T17:01:18Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548833#M152245</link>
      <description>&lt;P&gt;That works because * expands to just a single variable since the result of the inner query only has one column.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 17:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548833#M152245</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-04-05T17:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548834#M152246</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/66894"&gt;@nd&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not clear what you want. Is it a list of variable names or variable values?, and how should they be separated?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide example data for new and old data sets and the expected output (macro variable value)&lt;/P&gt;</description>
      <pubDate>Fri, 05 Apr 2019 17:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548834#M152246</guid>
      <dc:creator>ErikLund_Jensen</dc:creator>
      <dc:date>2019-04-05T17:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a macro list in PROC SQL using results from EXCEPT</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548837#M152248</link>
      <description>Thanks, this is a big help!</description>
      <pubDate>Fri, 05 Apr 2019 17:09:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-macro-list-in-PROC-SQL-using-results-from-EXCEPT/m-p/548837#M152248</guid>
      <dc:creator>nd</dc:creator>
      <dc:date>2019-04-05T17:09:25Z</dc:date>
    </item>
  </channel>
</rss>

