<?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: How to import all excel files from a folder also create a new variable to store the file number in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961297#M374769</link>
    <description>&lt;P&gt;Your favorite internet search engine finds lots of hits when you search for&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS read all excel files in a folder&lt;/P&gt;</description>
    <pubDate>Sat, 08 Mar 2025 12:44:55 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2025-03-08T12:44:55Z</dc:date>
    <item>
      <title>How to import all excel files from a folder also create a new variable to store the file number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961296#M374768</link>
      <description>&lt;P&gt;Actually i have 1000 excel files in a folder. How to import all excel files from a folder and add all records into data, Also create a new variable in same data set to store the excel file number.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Mar 2025 12:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961296#M374768</guid>
      <dc:creator>gsreddy</dc:creator>
      <dc:date>2025-03-08T12:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to import all excel files from a folder also create a new variable to store the file number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961297#M374769</link>
      <description>&lt;P&gt;Your favorite internet search engine finds lots of hits when you search for&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS read all excel files in a folder&lt;/P&gt;</description>
      <pubDate>Sat, 08 Mar 2025 12:44:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961297#M374769</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2025-03-08T12:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to import all excel files from a folder also create a new variable to store the file number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961298#M374770</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Warning:&amp;nbsp;&lt;/STRONG&gt;The SAS Import engine will make guesses for each file imported as to variable name, type and length. Which with as many files as you have typically means that some of the variables are of different types even from the same column that should be the same type as you perceive the file and the multiple lengths means that combining data sets later may lead to lose of data because of the rules involved when doing such.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IF these files are supposed to be of the same structure it may be worth the effort to save all of the files as CSV (yes 1000 files may take awhile) and write a data step to the resulting files (or import a few of those and edit the generated SAS code) to read such and set the properties you expect for each column. The INFILE statement used with a data step but not in IMPORT will also allow creating a variable using the FILENAME= that you can parse from the file name to add a variable, which I am assuming is meant by "Excel file number".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25625"&gt;@gsreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Actually i have 1000 excel files in a folder. How to import all excel files from a folder and add all records into data, Also create a new variable in same data set to store the excel file number.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Mar 2025 13:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961298#M374770</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2025-03-08T13:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to import all excel files from a folder also create a new variable to store the file number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961324#M374775</link>
      <description>I got info from search engine to import files.looking to store file number in new variable</description>
      <pubDate>Sat, 08 Mar 2025 18:30:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961324#M374775</guid>
      <dc:creator>gsreddy</dc:creator>
      <dc:date>2025-03-08T18:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to import all excel files from a folder also create a new variable to store the file number</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961333#M374779</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25625"&gt;@gsreddy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I got info from search engine to import files.looking to store file number in new variable&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;For detailed help you need to provide more information on what you have already created.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To add a numeric variable to a dataset just run a data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   file_number = 1;
   set have;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 08 Mar 2025 22:31:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-all-excel-files-from-a-folder-also-create-a-new/m-p/961333#M374779</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-03-08T22:31:20Z</dc:date>
    </item>
  </channel>
</rss>

