Date: Thu, 29 Mar 2007 06:34:49 -0700
Reply-To: barry.debenham@TALK21.COM
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: barry.debenham@TALK21.COM
Organization: http://groups.google.com
Subject: Re: csv file
In-Reply-To: <F5B70821B5BDAD4386B981A296C3402B48B08F@CAMPUSV3.xds.umail.utah.edu>
Content-Type: text/plain; charset="iso-8859-1"
On 29 Mar, 12:00, j...@UTAH.EDU (Jose Gerardo Benuzillo) wrote:
> Dear SAS - L Users,
>
> =20
>
> I have been trying to read a csv file into SAS without success. I think
> the problem is that one of the variables has ',' within it.
>
> I have used the proc import and I have used the following syntax:
>
> =20
>
> data scripts;
>
> infile " "
>
> delimiter =3D ',' MISSOVER DSD lrecl=3D2000 firstobs=3D2 ;
>
> length;
>
> input;
>
> run;
>
> =20
>
> Data sample:
>
> 0,70,4,1,1,"general",57,52,41,47,57
> 1,121,4,2,1,"vocati",68,59,53,63,61
> 0,86,4,3,1,"general",44,33,54,58,31
> 0,141,4,3,1,"vocati",63,44,47,53,56
> 0,172,4,2,1,"a,b,c,d",47,52,57,53,61
>
> =20
>
> =20
>
> Do I need some kind of qualifier?
>
> =20
>
> Thanks=20
>
> Jose
>
> =20
>
> =20
Jose,
You can just use the tilde (~) format modifier.
Here's an example:
data
a;
infile cards
DSD;
input a1 b1 c1 $~
d1 ;
cards;
1, 2, '3',
4
1,2,'3,4',
5
;
run;
Proc Print gives the following output:
Obs a1 b1 c1 d1
1 1 2 '3' 4
2 1 2 '3,4' 5
I hope it's what you want.
Regards,
Barry D.
|