BookmarkSubscribeRSS Feed
ad123123
Fluorite | Level 6

Hello All,

 

I am using proc export to export data into .csv file and facing some problem. In my data " is present.When I am exporting it using proc export , it is getting repeated 4 times and " becomes """".  I have seen some solutions on this but unfortunately I need to fix this using proc export only. This happens only with " (unmatched double quotes). All other special characters like @,#,$ are exported correctly. I am using SAS 9.2 EG on Unix environment.

 

Can anyone helps me why proc export behaves like this and what is a solution for this?

 

Regards,

AD.

2 REPLIES 2
RW9
Diamond | Level 26 RW9
Diamond | Level 26

If your data contains ", then the output file needs to have more quotes to indicate that the overall string starts from and finishes at.  E.g.

Abcde"efg

If I put one set of quotes round this:

"Abcd"efg"

Thats an invalid string, so need to add more quotes:

""Abcd"efg""

 

Basically if you want a file to look how you want, I would write the datastep to output it.  Also check this post:

https://communities.sas.com/t5/SAS-Procedures/Proc-Export-adding-extra-quotation-marks/td-p/90021

ballardw
Super User

I have had to read files that some creatively modified the rules for quotes for delimited text such that I had values like

 

column1, "Some text with, and " in the middle", 45.3, column4 text.

 

And those break almost every standard import tool.

 

Manually write a couple of lines similar to what I show (or you seem to want). Then use proc import to read the file. Or import into Access or some other data base as a CSV and see what you get.

 

One might ask what you will do with the resulting file.

 

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Get the $99 certification deal.jpg

 

 

Back in the Classroom!

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

View all other training opportunities.

Discussion stats
  • 2 replies
  • 929 views
  • 0 likes
  • 3 in conversation