![]() |
Macros for SAS Application Developers
https://github.com/sasjs/core |
Export a dataset to a CSV file WITH leading blanks. More...
Go to the source code of this file.
Export a dataset to a file or fileref, retaining leading blanks.
When using SASJS headerformat, the input statement is provided in the first row of the CSV.
Usage:
%mp_ds2csv(sashelp.class,outref="%sysfunc(pathname(work))/file.csv") filename example temp; %mp_ds2csv(sashelp.air,outref=example,headerformat=SASJS) data; infile example; input;put _infile_; if _n_>5 then stop;run; data _null_; infile example; input; call symputx('stmnt',_infile_); stop; run; data work.want; infile example dsd firstobs=2; input &stmnt; run;
Why use mp_ds2csv over, say, proc export?
[in] | ds | The dataset to be exported |
[in] | dlm= | (COMMA) The delimeter to apply. For SASJS, will always be COMMA. Supported values:
|
[in] | headerformat= | (LABEL) The format to use for the header section. Valid values:
|
[out] | outfile= | The output filename - should be quoted. |
[out] | outref= | (0) The output fileref (takes precedence if provided) |
[in] | outencoding= | (0) The (quoted) output encoding to use, eg "UTF-8" |
[in] | termstr= | (CRLF) The line seperator to use. For SASJS, will always be CRLF. Valid values:
SAS Macros |
Definition in file mp_ds2csv.sas.