<?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: How to list all the datasets with same end in a simpler way? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926034#M364401</link>
    <description>&lt;P&gt;Here is a reference that illustrates how to refer to variables and datasets in a short cut list:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The method you're looking for unfortunately doesn't easily exist. The are workarounds (see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;'s answer) and other methods you can use are in the post above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/413294"&gt;@Robin_moon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I saw a loop code the other day. And it generate files of output_&amp;amp;i (i.e. output_1, output_2,..., output_n). At the end, it row bind all the files as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
     set output_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It seems that we could list files output_1, output_2, ... , output_n in a simple way by using ":" as output_:, so I tried to row bind my files that all end up with "_output" (i.e. 1_output, 2_output, 3_output) in a similar way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
    set :_output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it failed. I'd like to know how to write the code in the right way. Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 26 Apr 2024 15:07:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2024-04-26T15:07:24Z</dc:date>
    <item>
      <title>How to list all the datasets with same end in a simpler way?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/925957#M364361</link>
      <description>&lt;P&gt;I saw a loop code the other day. And it generate files of output_&amp;amp;i (i.e. output_1, output_2,..., output_n). At the end, it row bind all the files as:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
     set output_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It seems that we could list files output_1, output_2, ... , output_n in a simple way by using ":" as output_:, so I tried to row bind my files that all end up with "_output" (i.e. 1_output, 2_output, 3_output) in a similar way:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
    set :_output;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;But it failed. I'd like to know how to write the code in the right way. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 06:58:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/925957#M364361</guid>
      <dc:creator>Robin_moon</dc:creator>
      <dc:date>2024-04-26T06:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all the datasets with same end in a simpler way?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/925959#M364363</link>
      <description>&lt;P&gt;The : wildcard works only for variable parts at the end of a dataset name.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select memname into :datasets separated by " "
from dictionary.tables
where libname = "WORK" and memname like '%_OUTPUT';
quit;

data all_results;
set &amp;amp;datasets.;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Apr 2024 07:32:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/925959#M364363</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-04-26T07:32:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all the datasets with same end in a simpler way?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926022#M364395</link>
      <description>&lt;P&gt;The : wildcard only works at the end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simplest solution is to change your naming pattern to use a common prefix instead.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you will have to build your own logic to make the list.&amp;nbsp; If the list is small enough (less than 64K bytes) then you can insert it into a macro variable.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
%let dslist=;
select nliteral(memname) into :dslist separated by ' '
from dictionary.members
where libname='WORK'
  and memtype in ('DATA','VIEW')
  and memname like '%COUNT'
;
quit;

data countall;
  set &amp;amp;dslist;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that if you are using the numeric suffix then you can a range of values instead.&amp;nbsp; That way you could reference COUNT1 to COUNT5 and also ignore COUNTALL.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data countall;
  set count1-count5;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 14:21:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926022#M364395</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-04-26T14:21:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all the datasets with same end in a simpler way?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926034#M364401</link>
      <description>&lt;P&gt;Here is a reference that illustrates how to refer to variables and datasets in a short cut list:&lt;BR /&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The method you're looking for unfortunately doesn't easily exist. The are workarounds (see &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;'s answer) and other methods you can use are in the post above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/413294"&gt;@Robin_moon&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I saw a loop code the other day. And it generate files of output_&amp;amp;i (i.e. output_1, output_2,..., output_n). At the end, it row bind all the files as:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
     set output_:;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It seems that we could list files output_1, output_2, ... , output_n in a simple way by using ":" as output_:, so I tried to row bind my files that all end up with "_output" (i.e. 1_output, 2_output, 3_output) in a similar way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=""&gt;data all_results;
    set :_output;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But it failed. I'd like to know how to write the code in the right way. Thanks!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2024 15:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926034#M364401</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2024-04-26T15:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to list all the datasets with same end in a simpler way?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926209#M364489</link>
      <description>Thanks for sharing the link. So sad to hear from that. SAS has a shortcut for selecting variables with same prefix but not for suffix.</description>
      <pubDate>Sun, 28 Apr 2024 08:57:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-list-all-the-datasets-with-same-end-in-a-simpler-way/m-p/926209#M364489</guid>
      <dc:creator>Robin_moon</dc:creator>
      <dc:date>2024-04-28T08:57:40Z</dc:date>
    </item>
  </channel>
</rss>

