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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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