Hi,
i have a problem with proc export, labels and quotes.
I need to export a file with a ":" inside the header field.
Now i'm using the classic proc export:
PROC EXPORT DATA= example
OUTFILE= "path\example.csv"
DBMS=DLM LABEL REPLACE;
DELIMITER='2C'x;
PUTNAMES=YES;
RUN;
And this is what i have:
"example:1" , "example:2"
I just need: example:1 , example:2 without quotes but with the " : " inside the name of the field.
How can i do in order to export properly?
Thank you very much.
Marco
If you don't want quotes in the header row, write the data step yourself, or adapt the one that proc export created for you (take it from the log).
data have;
input example_1 example_2;
label
example_1 = "example:1"
example_2 = "example:2"
;
datalines;
1 2
3 4
;
data _null_;
set have;
file "/folders/myfolders/example.csv" dlm="," dsd;
if _n_ = 1 then put "example:1,example:2";
put example_1 example_2;
run;
If you don't want quotes in the header row, write the data step yourself, or adapt the one that proc export created for you (take it from the log).
data have;
input example_1 example_2;
label
example_1 = "example:1"
example_2 = "example:2"
;
datalines;
1 2
3 4
;
data _null_;
set have;
file "/folders/myfolders/example.csv" dlm="," dsd;
if _n_ = 1 then put "example:1,example:2";
put example_1 example_2;
run;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.