<?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 storing a list of values from a field in a file in a macro variable... in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36813#M7239</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First put it in a dataset.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data exclude ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'exclude.csv' dsd firstobs=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input grp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then ... Since you have it in a dataset forget about the macro variable and just use the dataset in the query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you must put it into a macro variable use the INTO clause in PROC SQL select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct grp into :list separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp; from exclude&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Mar 2012 22:14:58 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-03-19T22:14:58Z</dc:date>
    <item>
      <title>storing a list of values from a field in a file in a macro variable...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36812#M7238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to store a a list of values from a file in a file in a macro variable.&amp;nbsp; I then would like to select all the rows from a dataset that do not have a value stored in the macro variable.&amp;nbsp; HEre's what I have so far:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select grp sum(total) &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from claims&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where grp not in (&amp;amp;list);&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get the variables in to the "list" macro variable?&amp;nbsp; The values that should populate the "list" macro variable are from a column in a csv file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 22:07:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36812#M7238</guid>
      <dc:creator>teg_76</dc:creator>
      <dc:date>2012-03-19T22:07:04Z</dc:date>
    </item>
    <item>
      <title>storing a list of values from a field in a file in a macro variable...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36813#M7239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First put it in a dataset.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data exclude ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile 'exclude.csv' dsd firstobs=2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; input grp;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then ... Since you have it in a dataset forget about the macro variable and just use the dataset in the query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you must put it into a macro variable use the INTO clause in PROC SQL select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select distinct grp into :list separated by ' '&lt;/P&gt;&lt;P&gt;&amp;nbsp; from exclude&lt;/P&gt;&lt;P&gt; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Mar 2012 22:14:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36813#M7239</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-19T22:14:58Z</dc:date>
    </item>
    <item>
      <title>storing a list of values from a field in a file in a macro variable...</title>
      <link>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36814#M7240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Plus, If grp is character ,then don't forget to add quote around it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Mar 2012 04:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/storing-a-list-of-values-from-a-field-in-a-file-in-a-macro/m-p/36814#M7240</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-03-20T04:18:45Z</dc:date>
    </item>
  </channel>
</rss>

