02-09-2017 09:07 AM
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?
02-09-2017 09:31 AM
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.
If I put one set of quotes round this:
Thats an invalid string, so need to add more quotes:
Basically if you want a file to look how you want, I would write the datastep to output it. Also check this post:
02-09-2017 11:03 AM
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.