<?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: read all sas data in a folder in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809293#M319128</link>
    <description>&lt;P&gt;So every dataset in the library has to be processed using the same statements. I am sure that such tasks have been solved many times - you will find them using the search function.&lt;/P&gt;
&lt;P&gt;Here's just a recipe:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write the step that process one file, have it fully tested.&lt;/LI&gt;
&lt;LI&gt;Convert the step to a macro, a parameter for the dataset is mandatory.&lt;/LI&gt;
&lt;LI&gt;Test the macro.&lt;/LI&gt;
&lt;LI&gt;Write a data step reading sashelp.vtable with where statement to process only the datasets in your library.&lt;/LI&gt;
&lt;LI&gt;use call execute to execute the macro for each dataset found.&lt;/LI&gt;
&lt;/OL&gt;</description>
    <pubDate>Fri, 22 Apr 2022 13:04:12 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2022-04-22T13:04:12Z</dc:date>
    <item>
      <title>read all sas data in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809281#M319119</link>
      <description>&lt;P&gt;Hi, community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am seeking an automatic way to read all SAS data in a folder to do the same process.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is my manual code. It works but takes time to key in all filenames.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;/**/&lt;/P&gt;
&lt;P&gt;Libname path "C:\myfolder\SAS";&lt;BR /&gt;Data &amp;amp;filename;&lt;BR /&gt;set path.&amp;amp;filename;&lt;BR /&gt;sas statements;&lt;/P&gt;
&lt;P&gt;.&lt;/P&gt;
&lt;P&gt;.&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;%let filename=a;&lt;/P&gt;
&lt;P&gt;%let filename=b;&lt;/P&gt;
&lt;P&gt;............&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 12:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809281#M319119</guid>
      <dc:creator>CHL0320</dc:creator>
      <dc:date>2022-04-22T12:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: read all sas data in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809289#M319125</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    select memname into :names separated by ' ' from dictionary.tables where upcase(libname)='PATH';
quit;

%macro dothis;
    %do i=1 %to %sysfunc(countw(&amp;amp;names));
        %let thisname = %scan(&amp;amp;names,&amp;amp;i,%str( ));
        data &amp;amp;thisname;
            set path.&amp;amp;thisname;
            /* other sas statements */
        run;
    %end;
%mend;

%dothis&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Apr 2022 12:55:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809289#M319125</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-22T12:55:50Z</dc:date>
    </item>
    <item>
      <title>Re: read all sas data in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809292#M319127</link>
      <description>Thank you. It works like magic.</description>
      <pubDate>Fri, 22 Apr 2022 13:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809292#M319127</guid>
      <dc:creator>CHL0320</dc:creator>
      <dc:date>2022-04-22T13:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: read all sas data in a folder</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809293#M319128</link>
      <description>&lt;P&gt;So every dataset in the library has to be processed using the same statements. I am sure that such tasks have been solved many times - you will find them using the search function.&lt;/P&gt;
&lt;P&gt;Here's just a recipe:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Write the step that process one file, have it fully tested.&lt;/LI&gt;
&lt;LI&gt;Convert the step to a macro, a parameter for the dataset is mandatory.&lt;/LI&gt;
&lt;LI&gt;Test the macro.&lt;/LI&gt;
&lt;LI&gt;Write a data step reading sashelp.vtable with where statement to process only the datasets in your library.&lt;/LI&gt;
&lt;LI&gt;use call execute to execute the macro for each dataset found.&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Fri, 22 Apr 2022 13:04:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-all-sas-data-in-a-folder/m-p/809293#M319128</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-04-22T13:04:12Z</dc:date>
    </item>
  </channel>
</rss>

