<?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: Combine .CSV files in one folder and Combine in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612917#M18330</link>
    <description>&lt;P&gt;You don't need to actually make any SAS datasets?&amp;nbsp; That is you just want to copy the lines of text from those files into another text file?&amp;nbsp; Where are you writing the new file? For simplicity let's assume it is in a different folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inpath=C:\MyDataFolder\ ;
%let outfile=C:\MyDataFolder2\bigfile.csv;
data _null_;
  length fname $256 ;
  infile "&amp;amp;inpath\*.csv" filename=fname ;
  file "&amp;amp;outfile";
  input;
  if _n_=1 or (fname=lag(fname) ) then put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want to re-copy everything every day?&amp;nbsp; or do you need a more complex process that keeps track of which files you have already copied?&amp;nbsp; Or perhaps just checks the timestamps on the files and appends the new files?&lt;/P&gt;</description>
    <pubDate>Thu, 19 Dec 2019 04:56:03 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-12-19T04:56:03Z</dc:date>
    <item>
      <title>Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612884#M18326</link>
      <description>&lt;P&gt;I have a folder located at C:\MyDataFolder&lt;/P&gt;&lt;P&gt;This folder contains multiple and identical excel .csv files and each file has the structure&amp;nbsp; as shown in table below. My goal is to combine (append) all these multiple files into one big file with the same structure and single header. The number of files in the folder continues to grow each day.&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;STRONG&gt;VAR1&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;VAR2&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;VAR3&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;36&lt;/TD&gt;&lt;TD&gt;41&lt;/TD&gt;&lt;TD&gt;25&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;44&lt;/TD&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;29&lt;/TD&gt;&lt;TD&gt;50&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;TD&gt;37&lt;/TD&gt;&lt;TD&gt;33&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;TD&gt;22&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;39&lt;/TD&gt;&lt;TD&gt;35&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;28&lt;/TD&gt;&lt;TD&gt;42&lt;/TD&gt;&lt;TD&gt;34&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;32&lt;/TD&gt;&lt;TD&gt;48&lt;/TD&gt;&lt;TD&gt;24&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;30&lt;/TD&gt;&lt;TD&gt;21&lt;/TD&gt;&lt;TD&gt;23&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 00:09:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612884#M18326</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-19T00:09:45Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612896#M18327</link>
      <description>&lt;P&gt;Looks like you're trying to do this:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;-unison&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 02:02:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612896#M18327</guid>
      <dc:creator>unison</dc:creator>
      <dc:date>2019-12-19T02:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612903#M18329</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/55388"&gt;@RADAGBE9&lt;/a&gt;&amp;nbsp;, Courtesy&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp; gave me this link&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;http://support.sas.com/kb/45/805.html&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;that lists all files in a directory&lt;/P&gt;
&lt;P&gt;Then use FILEVAR= to read those files&lt;/P&gt;
&lt;P&gt;Use this structure&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  Filename filelist pipe "dir /b /s c:\temp\*.sas"; /*your directory location*/
                                                                                   
   data want;                                        
     Infile filelist truncover;
     Input filename $300.;
    
     infile dummy filevar=filename dsd end=z;

     do until (z);
  
        input . . .;

        output;

     end;

  
   Run; 
&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 19 Dec 2019 02:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612903#M18329</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-12-19T02:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612917#M18330</link>
      <description>&lt;P&gt;You don't need to actually make any SAS datasets?&amp;nbsp; That is you just want to copy the lines of text from those files into another text file?&amp;nbsp; Where are you writing the new file? For simplicity let's assume it is in a different folder.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inpath=C:\MyDataFolder\ ;
%let outfile=C:\MyDataFolder2\bigfile.csv;
data _null_;
  length fname $256 ;
  infile "&amp;amp;inpath\*.csv" filename=fname ;
  file "&amp;amp;outfile";
  input;
  if _n_=1 or (fname=lag(fname) ) then put _infile_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Do you want to re-copy everything every day?&amp;nbsp; or do you need a more complex process that keeps track of which files you have already copied?&amp;nbsp; Or perhaps just checks the timestamps on the files and appends the new files?&lt;/P&gt;</description>
      <pubDate>Thu, 19 Dec 2019 04:56:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/612917#M18330</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-19T04:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613277#M18383</link>
      <description>&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;I want to actually combine all the .CSV files into one sas dataset for further manipulation.&lt;/P&gt;&lt;P&gt;The new data set would be written into a library.&lt;/P&gt;&lt;P&gt;My goal is to recopy the new files (for efficiency). So YES I'd not want&amp;nbsp;to recopy and combine all the files everyday.&lt;/P&gt;&lt;P&gt;Also, the filesnames are timestamped and unique.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So for example the files are:&lt;/P&gt;&lt;P&gt;C:\MyDataFolder\File.10.1.2019.csv&lt;/P&gt;&lt;P&gt;C:\MyDataFolder\File.10.2.2019.csv&lt;/P&gt;&lt;P&gt;C:\MyDataFolder\File.10.3.2019.csv&lt;/P&gt;&lt;P&gt;...etc&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the final should be&lt;/P&gt;&lt;P&gt;WORK.bigfile.sas7bdat&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Dec 2019 16:53:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613277#M18383</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-20T16:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613350#M18396</link>
      <description>&lt;P&gt;Not hard to read all of the files at once.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inpath=C:\MyDataFolder\ ;

data bigfile;
  length fname $256 ;
  infile "&amp;amp;inpath\*.csv" filename=fname truncover;
  input @;
  if _n_=1 or (fname=lag(fname) ) then delete;
  input var1 var2 var3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might want to add code to parse the date out of the filename (if the date is not already in one of the fields in the actual data).&amp;nbsp; You might need to add options like DSD to the INFILE statement and clear up the INPUT statement to properly read the variables you have.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to only read files after a particular date it might be better to generate the list of filenames first and filter that, then use the list to drive the reading.&amp;nbsp; (Note this type of filtering would be easier if the filenames use Y/M/D order of the date string in the filename since then the filenames would sort lexicographically into chronological order.)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inpath=C:\MyDataFolder\ ;
data filelist ;
  infile "dir ""&amp;amp;inpath.*.csv"" /b" pipe truncover;
  input fname $256. ;
run;

data bigfile;
  set filelist ;
  where '01JAN2019'd &amp;lt;=
mdy(input(scan(filename,-4,'.'),32.)
   ,input(scan(filename,-3,'.'),32.)
   ,input(scan(filename,-2,'.'),32.)
  );
  infile TXT filevar=fname truncover end=eof firstobs=2;
  do while (not eof);
    input var1 var2 var3;
    output;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 20 Dec 2019 21:22:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613350#M18396</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-20T21:22:03Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613414#M18411</link>
      <description>&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;I run the&amp;nbsp;code below but it returned no data.&amp;nbsp;Actually the variables in the data are 20. Do I need to list all of them in place of Var1, Var2 &amp;amp; Var3? Also what does fname represent?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; inpath&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;C:&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;MyDataFolder&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; bigfile&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token function"&gt;length&lt;/SPAN&gt; fname &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;256&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"&amp;amp;inpath\*.csv"&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;fname truncover&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; _n_&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; or &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;lag&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;delete&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; var1 var2 var3&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 00:53:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613414#M18411</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-22T00:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613438#M18416</link>
      <description>&lt;P&gt;Try reading just one file first to get the proper INPUT statement syntax for reading your 20 variables.&amp;nbsp; You might also want to add other statements like FORMAT, LABEL and possible INFORMAT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By using the FILENAME= option on the INFILE statement the FNAME variable named there is set to the name of the file that is currently being read.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The FNAME=LAG(FNAME) is testing whether you are currently reading the 2nd,3rd, etc line of that particular file.&amp;nbsp; For this you code you need to reverse that to FNAME ne LAG(FNAME) since you are deleting the records that match that condition.&amp;nbsp; The DELETE will let you skip the header row in each file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let inpath=C:\MyDataFolder;

data bigfile;
  length fname $256 ;
  infile "&amp;amp;inpath\*.csv" filename=fname truncover;
  input @;
  if fname ne lag(fname) then delete;
  input var1-var20;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 22 Dec 2019 18:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613438#M18416</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-22T18:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613467#M18422</link>
      <description>&lt;P&gt;Thanks Tom,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using SAS EG, so I'm able to import one .CSV into SAS successfully, which generates its own LENGTH, FORMAT &amp;amp; INFORMAT statements.&amp;nbsp;After that I added your code below&amp;nbsp;and replace&amp;nbsp;&amp;nbsp;"&amp;nbsp;&lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; var1&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;var20" with the INPUT from the SAS EG generated code. I also replaced the first inpath with the correct path. When I run this code, it creates an empty dataset instead of the combined dataset that I'm looking for. I appreciate your assistance.&amp;nbsp; Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token macroname"&gt;%let&lt;/SPAN&gt; inpath&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;C:&lt;SPAN class="token punctuation"&gt;\&lt;/SPAN&gt;MyDataFolder&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; bigfile&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token function"&gt;length&lt;/SPAN&gt; fname &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;256&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"&amp;amp;inpath\*.csv"&lt;/SPAN&gt; &lt;SPAN class="token statement"&gt;filename&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;fname truncover&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;@&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; fname &lt;SPAN class="token operator"&gt;ne&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;lag&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;fname&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;delete&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&amp;nbsp; &lt;SPAN class="token keyword"&gt;input&lt;/SPAN&gt; var1&lt;SPAN class="token operator"&gt;-&lt;/SPAN&gt;var20&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 23:47:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613467#M18422</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-22T23:47:15Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613475#M18423</link>
      <description>&lt;P&gt;You need to show the actual log from SAS to see if it is finding any of the files.&lt;/P&gt;
&lt;P&gt;You mentioned Enterprise Guide.&amp;nbsp; That is a program that runs on Windows and can connect to SAS running somewhere else.&amp;nbsp; It might connect to SAS running on the same machine where EG is running, but it might not.&amp;nbsp; Only you know how your setup is working.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For the posted code to work the folder with the CSV files in it needs to be visible on the machine where SAS is running.&amp;nbsp; So you might need to copy the files or place them in a shared folder of some type. If the server running SAS is using Unix then the path might look a lot different than it looks on your PC that is running EG.&amp;nbsp; Also on Unix filenames are case sensitive.&amp;nbsp; So x.csv is a different file than x.CSV.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 22 Dec 2019 23:58:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613475#M18423</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-22T23:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613477#M18424</link>
      <description>&lt;P&gt;Thank you &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205" target="_self"&gt;&lt;SPAN class="login-bold"&gt;novinosrin.&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;I'm&amp;nbsp;trying to read .CSV files&amp;nbsp; from my folder: &amp;nbsp;/home/username/&lt;/P&gt;&lt;P&gt;I'm unable to modify your code to read that.&amp;nbsp; New .csv files are added daily but I would not like to read all of the same files everyday. I want it to import only the newly added .csv files and append to the one BigFile.sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 00:02:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613477#M18424</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-23T00:02:46Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613481#M18425</link>
      <description>&lt;P&gt;Thanks for your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I successfully used the copy files task in SAS EG to copy *.csv&amp;nbsp; from&amp;nbsp; a shared folder on our network. So I can see all the CSV files have been loaded into my home directory in SAS EG, &amp;nbsp;which is visible to the to the SAS Server. Also our SAS runs on UNIX so the INFILE generated by File--&amp;gt;Import Data looks a bit different but it loads one .csv&amp;nbsp; all right. Also to add, I would not like the files to keep on loading all the files in the folder everyday. I want it to load the new ones that have been added and append to the one big SAS dataset&amp;nbsp;having all the daily files loaded.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 00:26:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613481#M18425</guid>
      <dc:creator>RADAGBE9</dc:creator>
      <dc:date>2019-12-23T00:26:30Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613484#M18426</link>
      <description>&lt;P&gt;Sounds like you can now find the files and read them.&lt;/P&gt;
&lt;P&gt;Now to only read the new files and append them you need some method for (1) getting the list of files (2) knowing which files have been read.&amp;nbsp; With those two pieces of information you can determine which files need to be read. Once you have read the new files can then append the data to end of your "big" dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to get the list of files it to read the output of your operating system command to list the file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data filelist;
  infile "ls &amp;amp;path/*.csv" pipe truncover ;
  input filename $256.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If that doesn't work you can use the DOPEN() and DREAD() functions.&amp;nbsp; That question has been answered many times on this site.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to keep track is to store the name of the file into a variable on the big dataset and then just query to find the list.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql ;
  create already_read_list as
  select distinct filename from sasfiles.big
  order by filename
  ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Another way is to maintain some separate file with just the list of files.&amp;nbsp; If the file names follow a pattern (such as having a date as part of the name) then you might not need to store the full filename, just the part that varies.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Dec 2019 04:33:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/613484#M18426</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-23T04:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: Combine .CSV files in one folder and Combine</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/981309#M43606</link>
      <description>&lt;P&gt;If you're looking for an advanced and automated tool to combine CSV files into one folder or files also for save both time and effort. Then I personally used this tool before and I'm recommending using &lt;STRONG&gt;SysTools CSV Merger Tool&lt;/STRONG&gt;. It's so amazing software which will surely help you in combining multiple of CSV files into single file in a few clicks.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Dec 2025 12:22:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Combine-CSV-files-in-one-folder-and-Combine/m-p/981309#M43606</guid>
      <dc:creator>techinmay</dc:creator>
      <dc:date>2025-12-26T12:22:09Z</dc:date>
    </item>
  </channel>
</rss>

