Hi I am trying to export a sas dataset to a delimited txt file using proc export but i am getting double quotes around the column names in the file. I am using label to print out column names without the '_' character . PFA the code
data OUTPUT_TABLE;
set OUTPUT_TABLE_1;
label External_Source='External Source'
External_Metric_Id='External Metric Id'
Metric_Name='Metric Name'
run;
/* Create and export flat file */
proc export data=OUTPUT_TABLE
outfile="/outbound/report/metric_&asOfMonth._&extractDate.-&extractTime..txt"
dbms=dlm label replace;
delimiter='|';
run;
the txt file has the column names as
"External Source"|"External Metric Id"|"Metric Name"|
is there a way to remove the "" from the labels while exporting to the file.?
I don't believe there's a way in PROC EXPORT, you'll have to use a data step instead.
That being said, this is a common convention when exporting text files since it creates a data set that will also account for any embedded pipes. That's less likely to happen with pipes, but is useful when commas are the delimiters.
@Anand08 wrote:
Hi I am trying to export a sas dataset to a delimited txt file using proc export but i am getting double quotes around the column names in the file. I am using label to print out column names without the '_' character . PFA the code
data OUTPUT_TABLE;
set OUTPUT_TABLE_1;
label External_Source='External Source'
External_Metric_Id='External Metric Id'
Metric_Name='Metric Name'
run;
/* Create and export flat file */
proc export data=OUTPUT_TABLE
outfile="/outbound/report/metric_&asOfMonth._&extractDate.-&extractTime..txt"
dbms=dlm label replace;
delimiter='|';
run;
the txt file has the column names as
"External Source"|"External Metric Id"|"Metric Name"|
is there a way to remove the "" from the labels while exporting to the file.?
Hello @Anand08,
Your question requires more details before experts can help. Can you revise your question to include more information?
Review this checklist:
To edit your original message, select the "blue gear" icon at the top of the message and select Edit Message. From there you can adjust the title and add more details to the body of the message. Or, simply reply to this message with any additional information you can supply.
SAS experts are eager to help -- help them by providing as much detail as you can.
This prewritten response was triggered for you by fellow SAS Support Communities member @ballardw
.I don't believe there's a way in PROC EXPORT, you'll have to use a data step instead.
That being said, this is a common convention when exporting text files since it creates a data set that will also account for any embedded pipes. That's less likely to happen with pipes, but is useful when commas are the delimiters.
@Anand08 wrote:
Hi I am trying to export a sas dataset to a delimited txt file using proc export but i am getting double quotes around the column names in the file. I am using label to print out column names without the '_' character . PFA the code
data OUTPUT_TABLE;
set OUTPUT_TABLE_1;
label External_Source='External Source'
External_Metric_Id='External Metric Id'
Metric_Name='Metric Name'
run;
/* Create and export flat file */
proc export data=OUTPUT_TABLE
outfile="/outbound/report/metric_&asOfMonth._&extractDate.-&extractTime..txt"
dbms=dlm label replace;
delimiter='|';
run;
the txt file has the column names as
"External Source"|"External Metric Id"|"Metric Name"|
is there a way to remove the "" from the labels while exporting to the file.?
Thanks Reeza, I was able to use a data _null_ step to produce the desired result
Try add an option.
options validvarname=any;
proc export ...........
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.