<?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 automate and import files that are located in date sequential folders into SAS? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192637#M36293</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This SAS community wiki page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Making_Lists" title="http://www.sascommunity.org/wiki/Making_Lists"&gt;http://www.sascommunity.org/wiki/Making_Lists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;has programs for making lists of both folders and files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; macro maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Mar 2014 22:36:32 GMT</pubDate>
    <dc:creator>Ron_MacroMaven</dc:creator>
    <dc:date>2014-03-06T22:36:32Z</dc:date>
    <item>
      <title>How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192626#M36282</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I currently have 700 folders that are all sequentially named. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The naming convention of the folders are as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2011-08-15_2011-08-15 &lt;/P&gt;&lt;P&gt;2011-08-16_2011-08-16&lt;/P&gt;&lt;P&gt;2011-08-17_2011-08-17&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;2013-09-20_2013-09-20&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 10 txt files within each folder that have the same naming convention.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With the txt files all being the same, what i am trying to achieve is to automate the infile and then use the name of the folder eg 2011-08-15_2011-08-15 or part of eg. 2011-08-15 to then be the name of the created data set.&lt;/P&gt;&lt;P&gt;I can successfully import all the txt files so there is no issue there, the issue is i dont want to be changing the folder name each time in the infile step.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'C:\SAS data\Extract\&lt;STRONG&gt;2011-08-17_2011-08-17&lt;/STRONG&gt;\abc.txt'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;is there an easier way to read these files in? I can find code for sequential txt/csv files but can find nothing to reference a folder and then rename the data set.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any assistance would be greatly appreciated!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 07:08:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192626#M36282</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-05T07:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192627#M36283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you please let us know the naming conventions of .TXT files within each of the folders...And if you are saying that you want to create the SAS Dataset with the name of folder name so my question is like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i have 10 .txt files in folder 2011-08-15_2011-08-15 and if i created one SAS Dataset with name of 2011-08-15 so it is like this dataset should include all 10 .txt files or you want separate dataset with each .txt files...&lt;/P&gt;&lt;P&gt;You can easily achive this task once you fix the naming conventions of .txt files and you want separate dataset for folder wise or file wise...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Urvish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 10:37:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192627#M36283</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2014-03-05T10:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192628#M36284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First create a data set with all required source files (full path and filename), then read one file after the other. In the example below variable "myinfile" contains the name of the file currently read. You can use this information to populate a permanent "output" variable containing the data source name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to create multiple SAS data sets (eg. 1 per folder), then you would have to pre-sort data set "flist" and in the second data step read the source and write the output to a hash table. You then use hash method "output". This allows you to dynamically create output data sets during data step execution time (using hash method "output" is the only way allowing this I'm aware of).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create a data set with the name and path of all files in all folders */&lt;BR /&gt;filename flist pipe 'dir /s/b/a-d c:\temp\*.txt';&lt;BR /&gt;data flist;&lt;BR /&gt;&amp;nbsp; infile flist lrecl=500 truncover;&lt;BR /&gt;&amp;nbsp; input this_file $500.;&lt;BR /&gt;&amp;nbsp; /* if not possible to filter sufficiently with the DIR command then add some additional */&lt;BR /&gt;&amp;nbsp; /* logic here to only select the desired files&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;run;&lt;BR /&gt;filename flist clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* now read the data from all files, one at a time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;/* this code based on: "Reading from Multiple Input Files"&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;/* &lt;A href="http://support.sas.com/documentation/cdl/en/lestmtsref/67175/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm"&gt;http://support.sas.com/documentation/cdl/en/lestmtsref/67175/HTML/default/viewer.htm#n1rill4udj0tfun1fvce3j401plo.htm&lt;/A&gt; */&lt;BR /&gt;data alldata;&lt;BR /&gt;&amp;nbsp; set flist;&lt;BR /&gt;&amp;nbsp; infile dummy lrecl=1000 truncover filevar=this_file &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename=myinfile end=done;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* DONE set to 1 when last input record read&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; do while(not done);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Read all input records from the currently&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* opened input file, write to alldata&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input string $1000.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put 'Finished reading ' myinfile=;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 11:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192628#M36284</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-03-05T11:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192629#M36285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like:&lt;/P&gt;&lt;P&gt;filename in_dir pipe 'dir "S:\Temp\Rob\Test" /s /b';&lt;/P&gt;&lt;P&gt;data all;&lt;BR /&gt;&amp;nbsp; attrib buff format=$200.;&lt;BR /&gt;&amp;nbsp; infile in_dir;&lt;BR /&gt;&amp;nbsp; input buff $;&lt;BR /&gt;&amp;nbsp; if index(upcase(buff),".TXT")=0 then delete;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table bse (var1 char(20),var2 char(20));&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set all;&lt;BR /&gt;&amp;nbsp; call execute('proc import datafile="'||strip(buff)||'" out=tmp dbms=dlm;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; getnames=no;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; delimiter=",";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc append base=bse data=tmp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 11:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192629#M36285</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-03-05T11:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192630#M36286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Urvish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The folder will be named&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2011-08-15_2011-08-15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The txt file names are as follows:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Order.txt&lt;/P&gt;&lt;P&gt;plugin.txt&lt;/P&gt;&lt;P&gt;product.txt&lt;/P&gt;&lt;P&gt;registration.txt&lt;/P&gt;&lt;P&gt;details.txt&lt;/P&gt;&lt;P&gt;cart.txt&lt;/P&gt;&lt;P&gt;technical.txt&lt;/P&gt;&lt;P&gt;page.txt&lt;/P&gt;&lt;P&gt;click.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So what im trying to achieve is 10 datasets per folder, they will be named with the folder heading in the name:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2011-08-15&lt;/SPAN&gt;_Order&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2011-08-15&lt;/SPAN&gt;_Plugin&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2011-08-15&lt;/SPAN&gt;_Product&lt;/P&gt;&lt;P&gt;etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;So with 700 different folders im hoping there is a way to append it and automate the import process of each directory and the files within.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Hope this makes sense.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Kind Regards,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Ryan &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 11:46:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192630#M36286</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-05T11:46:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192631#M36287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1. Do you now want 1 big data set or 10 or 700?&lt;/P&gt;&lt;P&gt;2. Is the structure of these 10 text files per folder the same or do we need a separate input statement per text file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;About 1) I would go for as few data sets as possible, eventually adding 2 new variables: one for the name of the data source, one with a date derived from the folder name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This can all be done quite easily with a variation to the code I've already posted earlier.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Mar 2014 20:28:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192631#M36287</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-03-05T20:28:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192632#M36288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Patrick,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your speedy response.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To answer your latest question i was going to create the latter 700, as i wasnt sure how to create the loop to obtain the 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to implement your code and it came back with an error, i have attached it below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile FLIST is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Unnamed Pipe Access Device,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PROCESS=dir /s/b/a-d C:\Desktop\SAS data\Extract\*.txt,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RECFM=V,LRECL=500&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there something that i am doing wrong, it is SAS for the PC. So im not sure if that is an issue or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 02:17:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192632#M36288</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-06T02:17:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192633#M36289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe the issue here is that you have a blank in the pathname "\SAS data\" which needs extra quoting. Below should do:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; filename flist pipe 'dir /s/b/a-d ''C:\Desktop\SAS data\Extract\*.txt''';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 04:16:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192633#M36289</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-03-06T04:16:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192634#M36290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick that did the trick. &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;I have used the code and it works! It has made just one data set which is great.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only issue i have now, which is from my original request, is i need to somehow use the date in the folder name to create a variable in the file. Each folder has the date range in the naming convention, and without a date within the txt file it is the only way to identify to timestamp the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way that i can append the date from the folder to the file so i can identify data by date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg. folder name &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;2011-08-15_2011-08-15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;file&lt;/P&gt;&lt;P&gt;order.txt &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;datalines&lt;/P&gt;&lt;P&gt;order&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; revenue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;123456&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 75.00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 2011-08-15&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Thanks again&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Ryan&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 07:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192634#M36290</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-06T07:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192635#M36291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Well, not sure wildcards can do that.&amp;nbsp; This is why I tend to go for the approach of create the list of items to process then generate the necessary code as below (updated to data step read as proc import seems to be out of favour).&amp;nbsp; Suppose it depends on how complicated/much needed these things are.&amp;nbsp; For instance if you need to create reports on the files, i.e. how many obs, titles, getting SVN trails etc.&amp;nbsp; Just seems simpler to create the list first.&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename in_dir pipe 'dir "S:\Temp\Rob\Test" /s /b';&lt;/P&gt;&lt;P&gt;data all;&lt;BR /&gt;&amp;nbsp; attrib buff format=$200.;&lt;BR /&gt;&amp;nbsp; infile in_dir;&lt;BR /&gt;&amp;nbsp; input buff $;&lt;BR /&gt;&amp;nbsp; if index(upcase(buff),".TXT")=0 then delete;&lt;BR /&gt;&amp;nbsp; date_var=scan(buff,5,"\");&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;&amp;nbsp; create table bse (var1 char(1000),var2 char(1000),var3 char(10));&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;&amp;nbsp; set all;&lt;BR /&gt;&amp;nbsp; call execute('data tmp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib var1 var2 format=$1000. var3 format=$10.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "'||strip(buff)||'" lrecl=1000 truncover dlm=",";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input var1 $ var2 $;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var3="'||strip(date_var)||'";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc append base=bse data=tmp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; run;');&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 09:10:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192635#M36291</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-03-06T09:10:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192636#M36292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 11pt;"&gt;Hi,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 11pt;"&gt;Here is my try based on previous comments...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 11pt;"&gt;I tried to fully automate the process but unfortunately, SAS is not supporting Macro Variable creation in DIR Command of FILENAME Statement...otherwise it will be very easy to automate...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 11pt;"&gt;So as you said you are having 700 Folders, what you can do, you can simply copy and paste the path in following code where i mentioned the comments...It's not tedious task...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: #000000; font-size: 11pt;"&gt;After that %FILES_IMPORT Macro will automatically append all the files in a folder and create the SAS dataset based on the folder name...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;filename&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; in_dir &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;pipe&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;'dir "C:\Documents and Settings\2011-08-15_2011-08-15"/b'&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Change the folder here*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; all;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;attrib&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; buff &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;format&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;$200.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;infile&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; in_dir;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;input&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; buff $;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;sql&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;noprint&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; buff &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;into&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; :all_files separated &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;by&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;" "&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;from&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;all&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &amp;amp;all_files.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; path = C:\Documents and Settings\2011-08-15_2011-08-15; &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: green; font-size: 11pt;"&gt;/*Change the folder here*/&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;STRONG&gt;&lt;EM&gt;files_import&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%global&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; dsn;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; dsn = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%qscan&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&amp;amp;path.,-1,"_");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; dsn = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(compress(&amp;amp;dsn.,"-"));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &amp;amp;dsn.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%let&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; tot_files = &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%qsysfunc&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(countc(&amp;amp;all_files.," "))+1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &amp;amp;tot_files.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp; filename myfiles (&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%to&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%eval&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;(&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;tot_files.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;"&amp;amp;path.\%qscan(%str(&amp;amp;all_files.),&amp;amp;i.,"&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;")"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: blue; font-size: 11pt;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;"&amp;amp;path.\%qscan(%str(&amp;amp;all_files.),&amp;amp;tot_files.,"&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; background: white; color: purple; font-size: 11pt;"&gt;")"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp; data ALL_&amp;amp;&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: teal; font-size: 11pt;"&gt;dsn.&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile myfiles;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input name $ age;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;&amp;nbsp;&amp;nbsp; run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 11pt; background: white; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;%&lt;STRONG&gt;&lt;EM&gt;files_import&lt;/EM&gt;&lt;/STRONG&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;Hope it meets your requirement and will reduce the time to do the repititive task...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt;-Urvish &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black; font-size: 11pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 10:48:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192636#M36292</guid>
      <dc:creator>UrvishShah</dc:creator>
      <dc:date>2014-03-06T10:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192637#M36293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This SAS community wiki page&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://www.sascommunity.org/wiki/Making_Lists" title="http://www.sascommunity.org/wiki/Making_Lists"&gt;http://www.sascommunity.org/wiki/Making_Lists&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;has programs for making lists of both folders and files.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ron Fehd&amp;nbsp; macro maven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 22:36:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192637#M36293</guid>
      <dc:creator>Ron_MacroMaven</dc:creator>
      <dc:date>2014-03-06T22:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192638#M36294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;All the info you need is contained in variable "this_file". You only need to extract it. See below code example.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data alldata;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set flist;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile dummy lrecl=1000 truncover filevar=this_file &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; filename=myinfile end=done;&lt;/P&gt;&lt;P&gt;&amp;nbsp; attrib&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Folder_Name length=$40 &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_From Date_To format=yymmdd10.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source length=$40&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Folder_Name=scan(this_file,-2,'/\');&lt;/P&gt;&lt;P&gt;&amp;nbsp; Source=scan(this_file,-1,'/\');&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date_From=input(scan(Folder_Name,1,'_'),yymmdd10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; Date_To=input(scan(Folder_Name,2,'_'),yymmdd10.);&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* DONE set to 1 when last input record read&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while(not done);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Read all input records from the currently&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* opened input file, write to alldata&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input string $1000.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Mar 2014 22:57:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192638#M36294</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-03-06T22:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192639#M36295</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Patrick, really appreciate all your help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It worked a treat!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 03:53:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192639#M36295</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-07T03:53:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192640#M36296</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your assistance, much appreciated!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 03:54:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192640#M36296</guid>
      <dc:creator>rjnc13</dc:creator>
      <dc:date>2014-03-07T03:54:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to automate and import files that are located in date sequential folders into SAS?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192641#M36297</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I am someone who likes to add a ReadMe.txt to top folders or eventually creates a backup copy of a folder during development, below a bit a more robust code variant (adding some checks):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* create a data set with the name and path of all files in all folders */&lt;BR /&gt;%let date_RegEx=(19|20)\d{2}-(0[1-9]|1[012])-([012]\d|3[01]);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename flist pipe 'dir /s/b/a-d "c:\temp\*.txt"';&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data flist;&lt;BR /&gt;&amp;nbsp; infile flist lrecl=500 truncover;&lt;BR /&gt;&amp;nbsp; input this_file $500.;&lt;BR /&gt;&amp;nbsp; attrib&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Folder_Name length=$40 &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Date_From Date_To format=yymmdd10.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Source length=$40&lt;BR /&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* remove all rows with folder names not complying with naming convention */&lt;BR /&gt;&amp;nbsp; Folder_Name=scan(this_file,-2,'/\');&lt;BR /&gt;&amp;nbsp; if prxmatch("/^&amp;amp;date_RegEx._&amp;amp;date_RegEx$/oi",strip(Folder_Name))&amp;lt;1 then delete;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Source=scan(this_file,-1,'/\');&lt;BR /&gt;&amp;nbsp; Date_From=input(scan(Folder_Name,1,'_'),yymmdd10.);&lt;BR /&gt;&amp;nbsp; Date_To=input(scan(Folder_Name,2,'_ '),yymmdd10.);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename flist clear;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data alldata;&lt;BR /&gt;&amp;nbsp; set flist;&lt;BR /&gt;&amp;nbsp; infile dummy lrecl=1000 truncover filevar=this_file end=done;&lt;BR /&gt;&amp;nbsp; /* DONE set to 1 when last input record read&amp;nbsp; */&lt;BR /&gt;&amp;nbsp; do while(not done);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Read all input records from the currently&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* opened input file, write to alldata&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input string $1000.;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;BR /&gt;&amp;nbsp; end;&lt;BR /&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Mar 2014 09:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-automate-and-import-files-that-are-located-in-date/m-p/192641#M36297</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2014-03-07T09:31:02Z</dc:date>
    </item>
  </channel>
</rss>

