BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Tiri6
Fluorite | Level 6

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

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

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;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

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;
Tiri6
Fluorite | Level 6
thank you very much. It was exactly what i needed. Have a nice day.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 2282 views
  • 0 likes
  • 2 in conversation