Amadeus cookies policy - you'll see this message only once.

Amadeus use cookies on this website. They help us to know a little bit about you and how you use our website, which improves the browsing experience and marketing - both for you and for others. They are stored locally on your computer or mobile device. To accept cookies, continue browsing as normal. Or, go to the privacy policy for more information.

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:

Program:

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;

or

file classcsv mod;