BookmarkSubscribeRSS Feed
Ju
Calcite | Level 5 Ju
Calcite | Level 5

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

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

Ju
Calcite | Level 5 Ju
Calcite | Level 5

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Ju
Calcite | Level 5 Ju
Calcite | Level 5

Wow! It works!

Many thanks! You are great! 🙂

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 5158 views
  • 1 like
  • 2 in conversation