BookmarkSubscribeRSS Feed
egamorim
Calcite | Level 5

When I export a file in txt, at the beginning and end of each line appears "(quotes) how do I prevent this from happening?

19 REPLIES 19
ChrisHemedinger
Community Manager

How are you exporting this?  Using EG menus or code? Try File->Export->Export [DATANAME], and select a CSV type.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
egamorim
Calcite | Level 5

I need to export in txt
With the table open I'm going to Export >> Export Step in Project
I select the format, in case txt and end.

When I do this procedure it is putting quotation marks at the beginning and end of each line.

Reeza
Super User

Post the code you're using.

egamorim
Calcite | Level 5

Não estou exportando através de código.
Com a tabela aberta estou indo em Export >> Export Step in Project
Seleciono o formato, no caso txt e fim.

Quando faço esse procedimento ele está colocando aspas no início e no fim de cada linha.

egamorim
Calcite | Level 5

I am not exporting through code.
With the table open I'm going to Export >> Export Step in Project
I select the format, in case txt and end.

When I do this procedure it is putting quotation marks at the beginning and end of each line.

CaseySmith
SAS Employee

What version of EG (listed in Help->About) are you using?  In newer versions of EG, only values that contain the delimiter will be wrapped in quotes when exported to text (to avoid the ambiguity).


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users

egamorim
Calcite | Level 5

version 5.1

Kurt_Bremser
Super User

@egamorim wrote:

I am not exporting through code.
With the table open I'm going to Export >> Export Step in Project
I select the format, in case txt and end.

When I do this procedure it is putting quotation marks at the beginning and end of each line.


There is ALWAYS code in SAS. EG is just a code generator, and as soon as a node is run, you get a tab with the code that was sent to the workspace server.

To be able to recreate your situation, we need

- that code I mentioned (to make sure that our actions in EG generate the same code)

- your dataset that you exported. Use the macro provided in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... to convert your dataset to a data step, and post that here in a code window (6th or 7th icon above the posting window).

ChrisHemedinger
Community Manager

Actually, as much as I hate to correct my friend @Kurt_Bremser, there is no SAS code for this step initated from "Export as a Step".  EG reads the data and uses local routines to generate a text file.  As Casey said, earlier versions of EG added unnecessary quotes -- this is corrected in EG 7.1.

 

You can, however, use SAS code to achieve what you need.  PROC EXPORT, ODS CSV, and simple DATA step can all be used to generate text files from data.  Your challenge would then be to copy that data file from your SAS server to your local PC, and that's what the Copy Files task is good for.  Here's a blog post that leads you through the steps.

SAS For Dummies 3rd Edition! Check out the new edition, covering SAS 9.4, SAS Viya, and all of the modern ways to use SAS!
egamorim
Calcite | Level 5

Yes, as mentioned by ChrisHemedinger, there is no code for the way I am doing it.

 

My table contains only 1 column called Mailing in text format.

 

Could you code in code how can I export this table into text format?

Kurt_Bremser
Super User

@egamorim wrote:

Yes, as mentioned by ChrisHemedinger, there is no code for the way I am doing it.

 

My table contains only 1 column called Mailing in text format.

 

Could you code in code how can I export this table into text format?


That's simple:

data have;
input email :$100.;
cards;
user.user@domain.com
another_user@some-domain.com
;
run;

data _null_;
file '$HOME/test.txt';
set have;
put email;
run;

The file test.txt looks like that:

user.user@domain.com
another_user@some-domain.com

As you can see, no quotes.

 

egamorim
Calcite | Level 5

Okay, but it still did not work out.


I am illustrating in the attached image.

 

Notice that in EG the quotes do not appear, but in the yes txt.


exemplo.jpg
egamorim
Calcite | Level 5

Can I export txt to my local machine?
On my desktop?

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 19 replies
  • 4949 views
  • 3 likes
  • 5 in conversation