<?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: import multiple files  using macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-files-using-macros/m-p/811368#M320013</link>
    <description>&lt;P&gt;A&amp;nbsp;&lt;EM&gt;professional&lt;/EM&gt; approach to move data between environments will not use Excel files as a means of transfer, and avoids the use of PROC IMPORT. Instead have well documented&amp;nbsp;&lt;EM&gt;text&lt;/EM&gt; files, which you read with a data step written according to the documentation.&lt;/P&gt;
&lt;P&gt;Such text files can be of variable record length, with either the lines separated by terminators (CR, LF, CRLF), or having a preceding length word (4 bytes binary, you get such from IBM mainframes, SAS provides a specific RECFM for this); or you have fixed-width text files (with or without record terminator).&lt;/P&gt;
&lt;P&gt;In the case of variable length lines, one usually has delimiters between the columns, or only the last column variable (once again, typical for mainframes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a professional environment, a macro like yours would therefore only make sense if all files had the same structure, and if that is the case, you do not use a macro, but a single data step using the FILEVAR= option (all data ends therefore up in a single dataset, and an "origin" variable might be kept).&lt;/P&gt;</description>
    <pubDate>Wed, 04 May 2022 05:50:44 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-05-04T05:50:44Z</dc:date>
    <item>
      <title>import multiple files  using macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-files-using-macros/m-p/811359#M320008</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import(file,dname);	
   Proc import datafile="&amp;amp;file" out=&amp;amp;dname
   Dbms=excel replace;
   Getnames=yes;
   Run;
%mend;
   %import(E:\sas\macro\data1.xls,ds1);
   %import(E:\sas\macro\data2.xls,ds2);
   %import(E:\sas\macro\data3.xls,ds3);
   %import(E:\sas\macro\data4.xls,ds4);
   %import(E:\sas\macro\data5.xls,ds5);
   %import(E:\sas\macro\data6.xls,ds6);
   %import(E:\sas\macro\data7.xls,ds7);
   %import(E:\sas\macro\data8.xls,ds8);
   %import(E:\sas\macro\data9.xls,ds9);
   %import(E:\sas\macro\data10.xls,ds10);

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;any other approach import multiple files into sas&amp;nbsp; every time call the macro with file location&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 04:15:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-files-using-macros/m-p/811359#M320008</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2022-05-04T04:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple files  using macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-files-using-macros/m-p/811368#M320013</link>
      <description>&lt;P&gt;A&amp;nbsp;&lt;EM&gt;professional&lt;/EM&gt; approach to move data between environments will not use Excel files as a means of transfer, and avoids the use of PROC IMPORT. Instead have well documented&amp;nbsp;&lt;EM&gt;text&lt;/EM&gt; files, which you read with a data step written according to the documentation.&lt;/P&gt;
&lt;P&gt;Such text files can be of variable record length, with either the lines separated by terminators (CR, LF, CRLF), or having a preceding length word (4 bytes binary, you get such from IBM mainframes, SAS provides a specific RECFM for this); or you have fixed-width text files (with or without record terminator).&lt;/P&gt;
&lt;P&gt;In the case of variable length lines, one usually has delimiters between the columns, or only the last column variable (once again, typical for mainframes).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In a professional environment, a macro like yours would therefore only make sense if all files had the same structure, and if that is the case, you do not use a macro, but a single data step using the FILEVAR= option (all data ends therefore up in a single dataset, and an "origin" variable might be kept).&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 05:50:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-files-using-macros/m-p/811368#M320013</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-05-04T05:50:44Z</dc:date>
    </item>
  </channel>
</rss>

