| Date: | Fri, 3 Dec 2010 03:31:32 +0000 |
| Reply-To: | toby dunn <tobydunn@HOTMAIL.COM> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | toby dunn <tobydunn@HOTMAIL.COM> |
| Subject: | Re: comma delimited values between double quotes |
|
| In-Reply-To: | <4400.96.236.11.70.1291345447.squirrel@webmail.albany.edu> |
| Content-Type: | text/plain; charset="iso-8859-1" |
Mike,
Yeah that also assumes the text has no imbedded double qoutes. Not use if that is the case or if the actual text to be read
in is as shown in the example. If it is as shown, then the PRX is a bit of over kill, if it isn't then the PRX is teh better route.
Either way I was given the chance to write some SAS code, man I was jones for it at about 5 this evening. Trying to
remember all my bash code after 6 years of not using it sucked.
Toby Dunn
"I'm a hell bent 100% Texan til I die"
"Don't touch my Willie, I don't know you that well"
> Date: Thu, 2 Dec 2010 22:04:07 -0500
> From: msz03@ALBANY.EDU
> Subject: Re: comma delimited values between double quotes
> To: SAS-L@LISTSERV.UGA.EDU
>
> hi ... once you get rid of the quotes (as Art did), it's just LIST input ...
>
> given this as test.txt ...
>
> "a,b,c,d,e"
> "1,2,3,4,5"
> "6,4,5,3,2"
> "2,1,5,7,"
>
> then ...
>
> data x;
> infile "z:\test.txt" firstobs=2 dsd;
> input @;
> _infile_ = compress(_infile_,'"');
> input a b c d e;
> run;
>
> proc print data=x noobs
> run;
>
> a b c d e
> 1 2 3 4 5
> 6 4 5 3 2
> 2 1 5 7 .
>
>
> --
> Mike Zdeb
> U@Albany School of Public Health
> One University Place (Room 119)
> Rensselaer, New York 12144-3456
> P/518-402-6479 F/630-604-1475
>
> > On Dec 2, 8:26 pm, db <daronnebonn...@gmail.com> wrote:
> >> Hi, I have a text fie that starts and ends with double quote ( " "). I
> >> need to just read values between double quotes which are delimited by
> >> comma. Could you help me how to do that ? Thanks!
> >>
> >> "a,b,c,d,e"
> >> "1,2,3,4,5"
> >> "6,4,5,3,2"
> >> "2,1,5,7,"
> >>
> >> data readin;
> >> infile txtfile dlm = ',' firstobs = 2;
> >> input aa bb cc dd ee ;
> >> run;
> >
|