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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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.

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
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?

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 19 replies
  • 2805 views
  • 3 likes
  • 5 in conversation