Production Ready Macros for SAS Application Developers
https://github.com/sasjs/core
mp_cleancsv.sas File Reference

Fixes embedded cr / lf / crlf in CSV. More...

Go to the source code of this file.

Detailed Description

CSVs will sometimes contain lf or crlf within quotes (eg when saved by excel). When the termstr is ALSO lf or crlf that can be tricky to process using SAS defaults. This macro converts any csv to follow the convention of a windows excel file, applying CRLF line endings and converting embedded cr and crlf to lf.

usage: fileref mycsv "/path/your/csv"; mp_cleancsv(in=mycsv,out=/path/new.csv)

Parameters
in=provide path or fileref to input csv
out=output path or fileref to output csv
qchar=quote char - hex code 22 is the double quote.
Version
9.2
Author
Allan Bowe

Definition in file mp_cleancsv.sas.