<?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: need a macro to read excel tables with similar names in a certain file into sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94150#M19840</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi LinusH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your prompt answer. I cannt really understand your method (have only one week experience with sas &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;). can you probably give me an example code, how this is going to look like?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would be very thankful for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 26 Sep 2013 10:10:43 GMT</pubDate>
    <dc:creator>Dingdang</dc:creator>
    <dc:date>2013-09-26T10:10:43Z</dc:date>
    <item>
      <title>need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94148#M19838</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am a beginner in sas and wondering if it is possible to write a macro to read external data like excel tables with similar names (eg. reports_a, reports_b, reports_c etc. ) which i saved in a certain file into sas. I wrote sth. like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro imp (path, name, n);&lt;/P&gt;&lt;P&gt;%Do i=1 %To &amp;amp;n;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import out=libl.test&amp;amp;i;&lt;/P&gt;&lt;P&gt;Datafile="&amp;amp;path.&amp;amp;name.&amp;amp;i..xls";&lt;/P&gt;&lt;P&gt;sheet="Table1";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%mend imp&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It doesnt look so good. Can someone give me some tips how i can do this? plus, actually i dont want to give n as a macro variable, cause i probabably dont know how many tables are there (of course i can check the file itself and get to know n myself, but that is not so schick, and everytime i got new reports coming in, this number is going to change), is it possible that sas does a loop and read the tables one by one until no tables are left unread? and is it possible that i save my sas dataset with the index from the original excel tables, like in my example a, b, c etc.? so that when i look at the name of the sas data sets, i know already exactly from whom this report comes from, from person a, b oder c and so on.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am very grateful for any kind of help and suggestions!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 07:08:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94148#M19838</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-09-26T07:08:55Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94149#M19839</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can first read the the contents of a directory (and stor it in a work table), and "pipe" all Excel file names into your macro instead, i.e. by using the call execute() construct.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 09:55:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94149#M19839</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-09-26T09:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94150#M19840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi LinusH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your prompt answer. I cannt really understand your method (have only one week experience with sas &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;). can you probably give me an example code, how this is going to look like?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;would be very thankful for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 10:10:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94150#M19840</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-09-26T10:10:43Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94151#M19841</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, this is maybe the first week kind of logic, but you'll probably learn something anyhow...&lt;/P&gt;&lt;P&gt;You can either use filename pipe to issue a OS dir command - which you can call in a data step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;meta code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename myDir pipe 'dir &lt;EM&gt;search-path&lt;/EM&gt;';&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;infile myDir;&lt;/P&gt;&lt;P&gt;input fileName &lt;EM&gt;input_spec&lt;/EM&gt;;&lt;/P&gt;&lt;P&gt;if &lt;EM&gt;subsetting&lt;/EM&gt;;&lt;/P&gt;&lt;P&gt;call execute('%imp(' || fileName || ');');&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 10:47:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94151#M19841</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2013-09-26T10:47:59Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94152#M19842</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This may be useful:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" class="active_link" href="https://communities.sas.com/message/50737#50737"&gt;https://communities.sas.com/message/50737#50737&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 10:54:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94152#M19842</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2013-09-26T10:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94153#M19843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi LinusH,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your code. In combination with Oleg's code i think i understand better how directory and call execute works &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&amp;nbsp; very useful tips!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 12:32:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94153#M19843</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-09-26T12:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: need a macro to read excel tables with similar names in a certain file into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94154#M19844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Oleg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your answer. this is exactly what i am looking for &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2013 12:33:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-a-macro-to-read-excel-tables-with-similar-names-in-a/m-p/94154#M19844</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-09-26T12:33:45Z</dc:date>
    </item>
  </channel>
</rss>

