title: Append multiple CSV files in SAS
body: <p>I need to import a large amount of csv files in one SAS dataset. They all have the same data structure (same variables, variable names on the first line). I usually work in SQL, but I am forced to this particular project in SAS of which I have only basic knowledge.</p>
  
  <p>For the moment, my code looks like this:</p>
  
  <pre><code>proc import out=work.data
     datafile = file1.csv
     DBMS=CSV REPLACE;
     GETNAMES=YES;
     DATAROW=2;
  
  proc import out=work.newData
     datafile = file2.csv
     DBMS=CSV REPLACE;
     GETNAMES=YES;
     DATAROW=2;
  
  proc append base=work.data 
              data=work.newData force;    
  run;
  </code></pre>
  
  <p>and so on for file3.csv ... file4.csv.</p>
  
  <p>There is, I am sure, a more elegant way of doing this, that is, looping over all csv files on one folder without writing them explicitly (there are a few thousand files).</p>
  
  <p>Thanks for your help.</p>