BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sas_learnsups
Obsidian | Level 7

Hi All,

When I  export my sas dataset to csv file. I notice that for character variable containing Address string automatically comes up with double quotes. While some records have quotes rest of the addresses don't have quotes.

 

For example:

address

" Unit 4, 103 apartment name"

2/3 some road name

 

I want the addresses without quotes. I use Export procedure to get the dataset into CSV file. I wonder if there is any way  , i can avoid getting quotes in CSV file.

 

Just to be clearer my sas dataset doesn't contain single or double quotes.

 

Thanks,

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Look at that address. It has a comma embedded, so if you export it like that to a CSV, how do you know where the delimiter is?

That row will have an extra comma which will cause all kinds of issues, so the convention is to add quotes and the comma in the quotes is ignored. Don't remove them.

 

If you really, really want to, you can use PUT statements instead which allows you to control it explicitly. 

 


@sas_learnsups wrote:

Hi All,

When I  export my sas dataset to csv file. I notice that for character variable containing Address string automatically comes up with double quotes. While some records have quotes rest of the addresses don't have quotes.

 

For example:

address

" Unit 4, 103 apartment name"

2/3 some road name

 

I want the addresses without quotes. I use Export procedure to get the dataset into CSV file. I wonder if there is any way  , i can avoid getting quotes in CSV file.

 

Just to be clearer my sas dataset doesn't contain single or double quotes.

 

Thanks,

 


 

View solution in original post

6 REPLIES 6
Reeza
Super User

Look at that address. It has a comma embedded, so if you export it like that to a CSV, how do you know where the delimiter is?

That row will have an extra comma which will cause all kinds of issues, so the convention is to add quotes and the comma in the quotes is ignored. Don't remove them.

 

If you really, really want to, you can use PUT statements instead which allows you to control it explicitly. 

 


@sas_learnsups wrote:

Hi All,

When I  export my sas dataset to csv file. I notice that for character variable containing Address string automatically comes up with double quotes. While some records have quotes rest of the addresses don't have quotes.

 

For example:

address

" Unit 4, 103 apartment name"

2/3 some road name

 

I want the addresses without quotes. I use Export procedure to get the dataset into CSV file. I wonder if there is any way  , i can avoid getting quotes in CSV file.

 

Just to be clearer my sas dataset doesn't contain single or double quotes.

 

Thanks,

 


 

sas_learnsups
Obsidian | Level 7
ohh! I get that now! Thanks for quick response.
ChrisNZ
Tourmaline | Level 20

Function dequote() does what you want. 

But as said above, what you want is not what you need.

novinosrin
Tourmaline | Level 20

@sas_learnsups  Sir/Madam, It would be more encouraging if you could rather  mark @Reeza as the accepted solution for the very intuitive detailed reasoning. We then community(you included) feel encouraged with such responses to delve more and more with interesting responses. Just a thought. Sorry for the bother. Thank you!

sas_learnsups
Obsidian | Level 7
Well I thought i marked her response as Solution but my reponses got marked. It wasnt intentional. Thanks though for pointing it out to me.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

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
  • 6 replies
  • 1843 views
  • 2 likes
  • 4 in conversation