<?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 How to import most recent excel file (from folder) in to SAS EG in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371537#M24251</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Eg: excel files(&lt;/P&gt;&lt;P&gt;exel28062017_060000.XLSX&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;exel28062017_050000.XLSX&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;exel28062017_070000.XLSX)&amp;nbsp;&lt;/SPAN&gt;in a folder ,which is located in shares path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would like to pick and import most recent (&lt;SPAN&gt;exel28062017_070000.XLSX)&lt;/SPAN&gt;&amp;nbsp;file from folder .&lt;/P&gt;&lt;P&gt;Kindly help me on importing the recent excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jun 2017 06:01:12 GMT</pubDate>
    <dc:creator>srinivaschary</dc:creator>
    <dc:date>2017-06-29T06:01:12Z</dc:date>
    <item>
      <title>How to import most recent excel file (from folder) in to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371537#M24251</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Eg: excel files(&lt;/P&gt;&lt;P&gt;exel28062017_060000.XLSX&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;exel28062017_050000.XLSX&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;exel28062017_070000.XLSX)&amp;nbsp;&lt;/SPAN&gt;in a folder ,which is located in shares path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i would like to pick and import most recent (&lt;SPAN&gt;exel28062017_070000.XLSX)&lt;/SPAN&gt;&amp;nbsp;file from folder .&lt;/P&gt;&lt;P&gt;Kindly help me on importing the recent excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 06:01:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371537#M24251</guid>
      <dc:creator>srinivaschary</dc:creator>
      <dc:date>2017-06-29T06:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to import most recent excel file (from folder) in to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371540#M24252</link>
      <description>&lt;P&gt;Start at the root of your problem and use a proper date format in the Excel filename.&lt;/P&gt;
&lt;P&gt;Using a ddmmyy format instead of yymmdd is simply dumb and causes unnecessary work.&lt;/P&gt;
&lt;P&gt;Then you would simply take the last line of an ordered list, and that's it.&lt;/P&gt;
&lt;P&gt;Maxim 33: Intelligent data makes for intelligent programs.&lt;/P&gt;
&lt;P&gt;As it is, you will have to jump through some loops:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Windows */
filename in pipe "dir &amp;amp;path. /b";
/* UNIX */
filename in pipe "cd &amp;amp;path.; ls";

data files;
infile in truncover;
input file_name $50.;
if upcase(substr(file_name,1,4)) = 'EXEL' and upcase(scan(file_name,2,'.')) = 'XLSX';
file_date = input(substr(file_name,5,8),ddmmyy8.);
run;

proc sort data=files;
by file_date descending file_name descending; /* by file_name to keep the order of times */
run;

data _null_;
set files;
if _n_ = 1 then call symput('excelfile',trim(file_name));
stop;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now you have your required filename in the macro variable &amp;amp;excelfile.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 06:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371540#M24252</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T06:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to import most recent excel file (from folder) in to SAS EG</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371542#M24254</link>
      <description>&lt;P&gt;Just to illustrate the usefulness of correctly used date formats in filenames (or any kind of list):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename in "cd &amp;amp;path.; ls|tail -1";

data _null_;
infile in truncover;
input file_name $50.;
call symput('excelfile',trim(file_name));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;gives you the most recent file on UNIX.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2017 06:33:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-import-most-recent-excel-file-from-folder-in-to-SAS-EG/m-p/371542#M24254</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-06-29T06:33:56Z</dc:date>
    </item>
  </channel>
</rss>

