Date: Wed, 21 Jun 2006 06:37:36 -0400
Reply-To: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject: Re: Selective Unquoting
If you don't want the quotes, why don't you use
short=compress(short,'"');
??
On Tue, 20 Jun 2006 22:02:28 -0500, Rob Rohrbough
<Rob@ROHRBOUGH-SYSTEMS.COM> wrote:
>I am trying to import a comma-delimited dataset over which I have limited
>control. The data contain some embedded quotes that have not been "doubled"
>for proper reading with the DSD option on the INFILE statement. I am trying
>to read them anyway - of course with some problems. A simple test case is
>as follows:
>
>data test;
> infile datalines dsd truncover;
> length Code $5;
> length Short $40;
> format AddDateQ mmddyy10.;
> input Code : Short : AddDateQ : mmddyy.;
> if substr(Short, 1, 1) = '"' and substr(Short, length(Short)-1, 1) = '"'
>then
> Short = dequote(Short);
>datalines;
>"DUMM1",""LEADING AND" EMBEDDED QUOTES",04/01/2002
>"DUMM2","trail quote"",04/01/2002
>"DUMM3","NO QUOTE",04/01/2002
>"DUMM4","EMBEDDED" QUOTE ONLY",04/01/2002
>;
>
>This example shows that my little after-the-fact unquoting code handles the
>trailing quote, but not the record containing both in initial and middle
>"undoubled" embedded quote nor just the embedded quote.
>
>I can't understand why the unquoting code doesn't catch the first and last
>datalines. If I examine the resulting "TEST" dataset, the quotes all are
>there, and my desk tracing seems to indicate that the unquoting should work.
>
>Ideas? TIA,
>
>Rob
>
>
>Rob Rohrbough
>Omaha, NE, USA
|