A Simple Technique for Outputting a Data Set to a CSV File
If you need to create a comma separated file from a SAS data set, then a quick and easy technique that avoids the need to insert commas between each variable is as follows:
filename classcsv 'c:class.csv'; data _null_; file classcsv; set sashelp.class; put (_all_)(','); run;
To output specific variables, replace '_ALL_' with the required variable names separated by spaces.
Adding the MOD option to the either the filename or file statement appends to the output file rather than overwriting existing values. Use
filename classcsv 'c:class.csv' mod;
file classcsv mod;