| Date: | Mon, 30 Nov 2009 12:12:43 -0600 |
| Reply-To: | Joe Matise <snoopy369@GMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Joe Matise <snoopy369@GMAIL.COM> |
| Subject: | Re: Smarter Text Qualifying Than Just DSD on Import |
|
| In-Reply-To: | <OF531C93FD.F8EA77AA-ON8525767E.0062C62C-8525767E.00638F76@washpost.com> |
| Content-Type: | text/plain; charset=ISO-8859-1 |
That is easy to deal with:
1. Change all quotation marks to a character not present in your data.
2. Change all pipes to quotation marks.
3. Import through normal DSD rules.
4. Revert the quotation marks.
I wonder if you could do it a bit easier by skipping the input/output and
actually changing the character map table (PROC TRANTAB, I believe) to make
SAS think | is " and " is ½ or something. Then import, and then revert to
the normal translation table...
-Joe
On Mon, Nov 30, 2009 at 12:07 PM, Dan T Keating <keatingd@washpost.com>wrote:
> A dataset I need to regularly import is comma-delimited and then uses
> pipes as the text qualifier rather than quotes (because the data itself is
> laden with both quotes and commas). I lobbied for just pipe-delimited but
> the providers noted that both MS Access and mysql have for many years made
> it very easy to designate the text qualifier as any character when
> importing delimited data. The data imports easily into both of them.
>
> If DSD would recognize pipes rather than quotes, it would work perfectly.
> To replicate the funtionality of DSD, I have to program my own version of
> scan that ignores commas enclosed within pipes. The bigger and better scan
> (9.2) does not include this -- its q operator only envisions quotes as the
> text qualifer.
>
> The SAS solution I think I have to shoot for is regular expression pattern
> matching.
>
> But a good SAS solution would be some flexibility in what DSD uses as its
> text qualifier. Am I wrong in concluding that the flexibility is not there
> now?
>
> Thanks.
>
> Dan
> _________________________________
> Dan Keating
> Graphics Editor/Data, The Washington Post
> (202) 334-5047, keatingd@washpost.com
>
|