Published on :
ETL SASHELP

Exporting Data to CSV

This code is also available in: Deutsch Español Français
This script uses PROC EXPORT to convert the SAS© table 'sashelp.class' into a CSV file named 'class.csv'. The file is saved in the path specified by the macro-variable '&path', and any existing file with the same name will be replaced.
Data Analysis

Type : SASHELP


Uses the 'class' table from the SASHELP library, which is a standard example data library provided with SAS.

1 Code Block
PROC EXPORT
Explanation :
This block uses the PROC EXPORT procedure to export the SAS dataset 'sashelp.class' to a CSV file. The `DATA` option specifies the source dataset. `OUTFILE` defines the path and name of the output CSV file, using a macro-variable `&path` for the location. `DBMS=csv` indicates that the output format is CSV. The `REPLACE` option allows replacing the CSV file if it already exists without generating an error.
Copied!
1PROC EXPORT DATA= sashelp.class
2 OUTFILE= "&path\data\class.csv"
3 DBMS=csv
4 REPLACE;
5 RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.