 <p>I agree this is a bad idea, but here is another possible solution;</p> <pre><code>data big; cust_id = 1; retain var1-var20000 0; run; data temp/view=temp; set big(keep=cust_id var1-var10000); run; proc export data=temp outfile='c:\temp\file1.csv' dbms=csv replace; run; data temp/view=temp; set big(keep=cust_id var10001-var20000); run; proc export data=temp outfile='c:\temp\file2.csv' dbms=csv replace; run; </code></pre> <p>To control the variables written, just change the view definition however you need. You originally asked about creating five CSVs, this creates two.</p> <p>You have to use a view because <code>PROC EXPORT</code> does not respect KEEP or DROP data set options. I don't think using a macro to do something like this is a good idea unless you are very sure you know what you are doing AND you need to run it multiple times with different scenarios.</p>