| Brooke Delgoffe |
Not all data starts in SAS and a common place it goes when coming from tertiary systems is a CSV. While CSV is a great
interoperability tool, it also comes with its share of pitfalls. Free-text with special characters, space padding, and HTML
tags are just a few of the things “clogging up” an easy PROC IMPORT and often turning programmers to use the
wonderful DATA step. Without the automatic metadata and structure capabilities, using the DATA step can be time
consuming – even if wonderful.
In this paper I plan to teach readers about the INFILE, FILE statements and
the use of BINARY read-in settings that allow them to input and output to a CSV – allowing ether an “in place” fix or
creation of a cleaned CSV. Use of parsing functions will help to identify pesky characters, name their replacements, or
eliminate them completely.
A macro will be presented to demonstrate the concepts and provide a runnable
solution to this pesky CSV problem.
Brief Outline:
· Introduction
· Concept 1: INFILE and FILE
Statements
·Concept 1 Exploration: Settings, Rules, and Functions
· Concept 2: FIND(),
PRXCHANGE(),TRANWRD(), and TRANSLATE() for Finding the Trouble
·Concept 2 Exploration: Examples in
Replacement, Finding, and Special Character References
·MACRO: %CSVprep_PROCIMPORT Step-by-Step
·
Use Cases in Practice
· Conclusion |