Hallo
how do I get rid of quotes (") in the txt-file I export from SAS?
Background:
My SAS script produces a file which contains one column containig the varchar expression. This file should be exported to txt (without headers).
At the moment the exported data in txt looks like that:
"k123 123 some text"
"k456 456 some other text"
What I need is:
k123 123 some text
k456 456 some other text
IMPORTANT NOTE: every row is one variable (even if it contains spaces inside)
Thank you in advance.
juila
Hi,
What method are you using to get the data out? Perhaps post some code?
If you use datastep with file, and a put statement with your variable, you can put it out any way you like, with/without quotes, formatted etc.
Example:
data have;
attrib some_text format=$200.;
some_text="k123 123 some text"; output;
some_text="k456 456 some other text"; output;
run;
data _null_;
set have;
file "s:\temp\rob\temp.txt";
put some_text;
run;
Thank you for quick response.
I have the following code:
filename file_1 "c:\path~\file_1.txt";
data _null_;
set want;
file file_1 dsd dlm='';
put (_all_)(:);
run;
Yes, you have the DLM='' statement on there. As your data contains spaces, SAS is helpfully quoting it. Remove the DLM= option and it should work correctly. You could also say DLM=','; to get the result.
Wow! It works!
Many thanks! You are great! 🙂
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.