How to get rid of quotes (") in the txt-file I export from sas

Reply
New Contributor Ju
New Contributor
Posts: 4

How to get rid of quotes (") in the txt-file I export from sas

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

Super User
Super User
Posts: 7,977

Re: How to get rid of quotes (") in the txt-file I export from sas

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;

New Contributor Ju
New Contributor
Posts: 4

Re: How to get rid of quotes (") in the txt-file I export from sas

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_)(Smiley Happy;

       run;

Super User
Super User
Posts: 7,977

Re: How to get rid of quotes (") in the txt-file I export from sas

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.

New Contributor Ju
New Contributor
Posts: 4

Re: How to get rid of quotes (") in the txt-file I export from sas

Wow! It works!

Many thanks! You are great! :-)

Ask a Question
Discussion stats
  • 4 replies
  • 535 views
  • 1 like
  • 2 in conversation