Sample 37456: Using ODS CSV as an alternative to the %DS2CSV macro
The SAS Output Delivery System (ODS) provides SAS users with the ability
to write output to other destinations including a comma-separated (CSV) file. The ODS CSV statement is valid in SAS 8.2 and higher. SAS users who are still using the older
%DS2CSV tool might find the ODS functionality a more user-friendly, flexible option. This functionality simply requires adding two ODS statements: one before the
procedure or DATA step that generates the output, and one at the end of
the program to close the destination.
The following example illustrates how to create output using both methods.
/* Using ODS CSV */
ods csv file='filename.csv';
proc print data=sashelp.class;
run;
ods csv close;
/* Using %DS2CSV macro */
%ds2csv (data=sashelp.class, runmode=b, csvfile=c:\class.csv);
For additional examples using the ODS CSV destination, see
Base SAS: SAS Notes and Concepts.
For the latest information on the CSV tagset, see
CSV, CSVALL, CSVBYLINE.
The other methods for writing SAS data to a CSV file include PROC EXPORT, the Export Wizard, and a DATA step with a FILE statement.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
ODS CSV provides a newer method for converting SAS data sets to CSV files
| Type: | Sample |
| Topic: | SAS Reference ==> ODS (Output Delivery System)
|
| Date Modified: | 2010-03-17 14:42:55 |
| Date Created: | 2009-10-14 09:20:10 |
Operating System and Release Information
| SAS System | Base SAS | z/OS | | |
| OpenVMS VAX | | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
| Microsoft Windows XP 64-bit Edition | | |
| Microsoft® Windows® for x64 | | |
| OS/2 | | |
| Microsoft Windows 7 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows XP Professional | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled HP-UX | | |
| 64-bit Enabled Solaris | | |
| ABI+ for Intel Architecture | | |
| AIX | | |
| HP-UX | | |
| HP-UX IPF | | |
| IRIX | | |
| Linux | | |
| Linux for x64 | | |
| Linux on Itanium | | |
| OpenVMS Alpha | | |
| OpenVMS on HP Integrity | | |
| Solaris | | |
| Solaris for x64 | | |
| Tru64 UNIX | | |