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.