<?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: pulling all the distinct values from a data set into a macro variable then using them. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748592#M235094</link>
    <description>&lt;P&gt;Did you READ the response in &lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-NOT-manually-type-all-50-values-in-a-macro/m-p/748582" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-NOT-manually-type-all-50-values-in-a-macro/m-p/748582&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I show you exactly how to do that&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
   select distinct origin into :originlist separated by ' '
   from sashelp.cars
   ;
quit;&lt;/PRE&gt;
&lt;P&gt;for one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and how to use the list.&lt;/P&gt;
&lt;P&gt;In a couple of different places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 17 Jun 2021 01:32:15 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-06-17T01:32:15Z</dc:date>
    <item>
      <title>pulling all the distinct values from a data set into a macro variable then using them.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748591#M235093</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to pull all distinct values from variable "SITEID" and then using them in a macro without typing all 118 SITEID values into&amp;nbsp; a proc step below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sort data=x;
by subject;
where siteid= "&amp;amp;siteid";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Jun 2021 01:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748591#M235093</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2021-06-17T01:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: pulling all the distinct values from a data set into a macro variable then using them.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748592#M235094</link>
      <description>&lt;P&gt;Did you READ the response in &lt;A href="https://communities.sas.com/t5/SAS-Programming/how-to-NOT-manually-type-all-50-values-in-a-macro/m-p/748582" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/how-to-NOT-manually-type-all-50-values-in-a-macro/m-p/748582&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I show you exactly how to do that&lt;/P&gt;
&lt;PRE&gt;proc sql noprint;
   select distinct origin into :originlist separated by ' '
   from sashelp.cars
   ;
quit;&lt;/PRE&gt;
&lt;P&gt;for one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and how to use the list.&lt;/P&gt;
&lt;P&gt;In a couple of different places.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 01:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748592#M235094</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-06-17T01:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: pulling all the distinct values from a data set into a macro variable then using them.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748603#M235104</link>
      <description>&lt;P&gt;Storing data in macro-variable is hardly necessary at all, so you may want to explain what you are trying to achieve. The step you showed needs at least a tweak setting the name of the dataset created according to the value of &amp;amp;siteId. But here the trouble starts: All values of SiteID must valid sas-names. So if you are not 100% sure that they won't invalidate the datasets name, you have to pre-process the values, taking care of not creating duplicates when replacing bad chars. This is much work. compared to by-group processing, which is available in nearly all procs.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Jun 2021 04:38:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/pulling-all-the-distinct-values-from-a-data-set-into-a-macro/m-p/748603#M235104</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-06-17T04:38:11Z</dc:date>
    </item>
  </channel>
</rss>

