<?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 combining many files when some are missing in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15460#M2059</link>
    <description>I'm combining many files.&lt;BR /&gt;
However, some of the files in my list do not exist.&lt;BR /&gt;
If a file does not exist then I get an error and the new data set is not created.&lt;BR /&gt;
How do I get around this problem?&lt;BR /&gt;
&lt;BR /&gt;
data my;&lt;BR /&gt;
set my_1-my_999;&lt;BR /&gt;
run;&lt;BR /&gt;
ERROR: File WORK.MY_3.DATA does not exist.&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
    <pubDate>Tue, 04 May 2010 22:28:44 GMT</pubDate>
    <dc:creator>gzr2mz39</dc:creator>
    <dc:date>2010-05-04T22:28:44Z</dc:date>
    <item>
      <title>combining many files when some are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15460#M2059</link>
      <description>I'm combining many files.&lt;BR /&gt;
However, some of the files in my list do not exist.&lt;BR /&gt;
If a file does not exist then I get an error and the new data set is not created.&lt;BR /&gt;
How do I get around this problem?&lt;BR /&gt;
&lt;BR /&gt;
data my;&lt;BR /&gt;
set my_1-my_999;&lt;BR /&gt;
run;&lt;BR /&gt;
ERROR: File WORK.MY_3.DATA does not exist.&lt;BR /&gt;
NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;
&lt;BR /&gt;
Thank you.</description>
      <pubDate>Tue, 04 May 2010 22:28:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15460#M2059</guid>
      <dc:creator>gzr2mz39</dc:creator>
      <dc:date>2010-05-04T22:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: combining many files when some are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15461#M2060</link>
      <description>The following is one solution to the problem that uses the dictionary tables and a macro variable to pass the list of existing datasets to the datastep that combines the datasets.&lt;BR /&gt;
&lt;BR /&gt;
/*&lt;BR /&gt;
simple example data to use to illustrate solution&lt;BR /&gt;
*/&lt;BR /&gt;
&lt;BR /&gt;
data a1;&lt;BR /&gt;
x=1;&lt;BR /&gt;
run;&lt;BR /&gt;
data a2;&lt;BR /&gt;
x=2;&lt;BR /&gt;
run;&lt;BR /&gt;
data a5;&lt;BR /&gt;
x=5;&lt;BR /&gt;
run;&lt;BR /&gt;
data a6;&lt;BR /&gt;
x=6;&lt;BR /&gt;
run;&lt;BR /&gt;
/*&lt;BR /&gt;
use sas dictionary tables to find out the &lt;BR /&gt;
names of the datasets that actually exist&lt;BR /&gt;
in the library.&lt;BR /&gt;
Then use the ability to generate a macro variable&lt;BR /&gt;
containing a list of values separated by blanks&lt;BR /&gt;
*/&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table tablenames as &lt;BR /&gt;
 select  &lt;BR /&gt;
memname&lt;BR /&gt;
from dictionary.members&lt;BR /&gt;
where libname="WORK"&lt;BR /&gt;
;&lt;BR /&gt;
select memname INTO :setlist SEPARATED BY ' ' &lt;BR /&gt;
from tablenames;&lt;BR /&gt;
quit;&lt;BR /&gt;
/*&lt;BR /&gt;
see what the value of the macro variable is&lt;BR /&gt;
*/&lt;BR /&gt;
%put &amp;amp;setlist;&lt;BR /&gt;
/*&lt;BR /&gt;
use the macro variable which gets replaced by&lt;BR /&gt;
the list of datasets&lt;BR /&gt;
*/&lt;BR /&gt;
&lt;BR /&gt;
data allx;&lt;BR /&gt;
set &amp;amp;setlist;&lt;BR /&gt;
run;</description>
      <pubDate>Wed, 05 May 2010 02:28:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15461#M2060</guid>
      <dc:creator>monei011</dc:creator>
      <dc:date>2010-05-05T02:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: combining many files when some are missing</title>
      <link>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15462#M2061</link>
      <description>The OP must be using SAS 9.2 because of the SET statement and using the hyphen for a consecutive file-range specification.  &lt;BR /&gt;
&lt;BR /&gt;
Additionally, some other options are using the OPTIONS setting NODSNFERR to convert the error to a warning message.  And, with SAS 9.2, the file-prefix in the SET statement can be used with a trailing colon character.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Wed, 05 May 2010 09:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/combining-many-files-when-some-are-missing/m-p/15462#M2061</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-05-05T09:11:35Z</dc:date>
    </item>
  </channel>
</rss>

