| Date: | Fri, 19 Mar 2004 16:51:42 -0500 |
| Reply-To: | Howard Schreier <Howard_Schreier@ITA.DOC.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Howard Schreier <Howard_Schreier@ITA.DOC.GOV> |
| Subject: | Re: Reading raw data with double quotes |
|---|
If for some reason you don't want the DSD behavior regarding consecutive
delimiters, the $QUOTE informat will do it:
data _null_;
infile cards dlm=',';
input (v1-v5)(:$quote40.);
put _infile_ / (v1-v5) (=);
cards;
But how come this method will fail to strip quotes if there is a space
between the comma (or the beginning of the line) and the opending quote,
but Jack's method does ot have that weakness?
On Thu, 18 Mar 2004 17:46:07 -0700, Jack Hamilton
<JackHamilton@FIRSTHEALTH.COM> wrote:
>See the DSD option on the INFILE statement.
>
>=====
>data _null_;
> infile cards dsd;
> length v1-v5 $40.;
> input v1-v5;
> put _infile_ / (v1-v5) (=);
>cards;
>"69 DEWEY AVE","","NEWBURY PARK","CA","91320"
>;;;;
>=====
>
>produces
>
>=====
>24 data _null_;
>25 infile cards dsd;
>26 length v1-v5 $40.;
>27 input v1-v5;
>28 put _infile_ / (v1-v5) (=);
>29 cards;
>
>"69 DEWEY AVE","","NEWBURY PARK","CA","91320"
>v1=69 DEWEY AVE v2= v3=NEWBURY PARK v4=CA v5=91320
>NOTE: DATA statement used:
> real time 0.03 seconds
> cpu time 0.00 seconds
>=====
>
>
>--
>JackHamilton@FirstHealth.com
>Manager, Technical Development
>Metrics Department, First Health
>West Sacramento, California USA
>
>>>> "0101 htns" <htns0101@YAHOO.COM> 03/18/2004 4:30 PM >>>
>Dear SAS-Lers,
>
>Any help on how to read the line below into sas would be greatly
>appreciated. I can read it in if it doesn't have the double quotes.
>
>"69 DEWEY AVE","","NEWBURY PARK","CA","91320"
>
>expected result (v2 has missing value)
>
>v1 v2 v3
>v4 v5
>
>69 DEWEY AVE NEWBURY PARK CA 91320
>
>TIA
>
>Huong
>
>
>Do you Yahoo!?
>Yahoo! Mail - More reliable, more storage, less spam
|