<?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: sas macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589278#M168524</link>
    <description>&lt;P&gt;For a thing like that, I would not use macros. I think it is easier and safer to write a program to a temporary file, and then %INCLUDE that, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dirlist pipe 'dir c:\myfiles\*.xlsx /b';

filename tempsas temp;
data _null_;
  infile dirlist;
  input;
  filename=_infile_;
  put "Proc import FILE='c:\myfiles\" filename +(-1) "'"/
        '  DBMS=EXCEL5 REPLACE out=Excel_Imp' _N_ ';' /
        '  GETNAMES=yes;' /
        'RUN;'
        ;
run;

%include tempsas;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Before submitting the %include statement, you can open the TEMPSAS file in an editor window, see if the generated code looks right, and try submitting one of the generated PROC IMPORT statements, to test if it works.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Sep 2019 07:10:19 GMT</pubDate>
    <dc:creator>s_lassen</dc:creator>
    <dc:date>2019-09-17T07:10:19Z</dc:date>
    <item>
      <title>sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589252#M168513</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;&lt;P&gt;i have different name of excel files how to import all excel files at a time by using macros&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 05:40:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589252#M168513</guid>
      <dc:creator>nayab_shaik</dc:creator>
      <dc:date>2019-09-17T05:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589262#M168515</link>
      <description>it depends on what are the names of these excel files.&lt;BR /&gt;</description>
      <pubDate>Tue, 17 Sep 2019 06:21:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589262#M168515</guid>
      <dc:creator>VinitvictorCorr</dc:creator>
      <dc:date>2019-09-17T06:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589265#M168518</link>
      <description>&lt;P&gt;As you have already been told&amp;nbsp;&lt;EM&gt;multiple&lt;/EM&gt; times, &lt;STRONG&gt;use descriptive subject lines&lt;/STRONG&gt;!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Start with successfully importing one Excel file. Then look what needs to be made dynamic, and replace that with macro variables. Finally, look for a way to create those macro variables automatically, by determining from how your files are stored (single vs. multiple directories etc.).&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 06:30:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589265#M168518</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-17T06:30:42Z</dc:date>
    </item>
    <item>
      <title>Re: sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589266#M168519</link>
      <description>&lt;P&gt;Clarify:&lt;/P&gt;
&lt;P&gt;1) Are all excel files in the same folder or in different folders?&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Are their names all in same format? (differ by suffix? date? something else?)&lt;/P&gt;
&lt;P&gt;2) Are all excel files of same type: .xls or .xlsx and which of them ?&lt;/P&gt;
&lt;P&gt;3) Are all excel files with same columns format?&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Do you wand to import all into one SAS dataset or each in its own one?&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All those info affect how to code the macro.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 06:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589266#M168519</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-09-17T06:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589278#M168524</link>
      <description>&lt;P&gt;For a thing like that, I would not use macros. I think it is easier and safer to write a program to a temporary file, and then %INCLUDE that, e.g.:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename dirlist pipe 'dir c:\myfiles\*.xlsx /b';

filename tempsas temp;
data _null_;
  infile dirlist;
  input;
  filename=_infile_;
  put "Proc import FILE='c:\myfiles\" filename +(-1) "'"/
        '  DBMS=EXCEL5 REPLACE out=Excel_Imp' _N_ ';' /
        '  GETNAMES=yes;' /
        'RUN;'
        ;
run;

%include tempsas;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Before submitting the %include statement, you can open the TEMPSAS file in an editor window, see if the generated code looks right, and try submitting one of the generated PROC IMPORT statements, to test if it works.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 07:10:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589278#M168524</guid>
      <dc:creator>s_lassen</dc:creator>
      <dc:date>2019-09-17T07:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: sas macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589305#M168532</link>
      <description>&lt;P&gt;BTW, a google search for&amp;nbsp;"sas communities reading multiple excel files" will reveal the many, many times this subject has been covered before.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Sep 2019 11:03:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sas-macros/m-p/589305#M168532</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-17T11:03:32Z</dc:date>
    </item>
  </channel>
</rss>

