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.

Using the %DS2CSV Macro

In SAS 9 you can use the %DS2CSV macro to convert SAS datasets into CSV files. This macro was previously available in SAS/IntrNet and now it can be used by any SAS program.



  • Data. Name of data set to export
  • Csvfile. CSV file to be created
  • Runmode. Needs to be set to "b" for batch or interactive SAS programs
  • Openmode. Replace or Append
  • Colhead. Y or N to add column headers into CSV file

Other useful parameters include:

  • Formats. Y or N to keep format values
  • Labels. Y or N to keep labels on column headings
  • Sepchar. To specify the hex code of the separator character, e.g.: you can also create tab-separated files
  • Var. List of variables to keep on the CSV file
  • Where. Expression to subset data for CSV file.