LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 1999, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 13 Sep 1999 17:10:19 -0400
Reply-To:     Victor Kamensky <kamensky@AECOM.YU.EDU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Victor Kamensky <kamensky@AECOM.YU.EDU>
Subject:      Re: CSV input with fields surrounded by double quotes
Comments: To: SAS-L@UGA.CC.UGA.EDU
Content-Type: text/plain; charset="us-ascii"

DSD DLM=',' will work only if there are no commas in the fields. I do not know a good way to deal with that. The only suggestion in DLM='"', but all the commas between fiels will become separate variables, which should be dropped.(DLM='","' does not work). Victor Kamensky Programmer Albert Einstein college of Medicine

>X-Mailer: Mozilla 4.5 [en]C-BMY (WinNT; U) >X-Accept-Language: en >Newsgroups: bit.listserv.sas-l >Date: Mon, 13 Sep 1999 15:32:44 -0400 >Reply-To: Robert J Krajcik <robert.krajcik@BMS.COM> >Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> >From: Robert J Krajcik <robert.krajcik@BMS.COM> >Organization: Bristol-Myers Squibb >Subject: Re: CSV input with fields surrounded by double quotes >To: SAS-L@LISTSERV.UGA.EDU > > Hi Bob. Try using the DSD INFILE option, as below: >Note how the tilde modifer retains the quotes > data _null_; > infile cards dsd dlm=','; > input a $ b ~$ c ~$ d $; > put a= b= c= d=; > datalines; A=100002 B="30" C="3" D=4/21/99 >A=100004 B="31" C="6" D=8/24/99 >A=100006 B="30" C="1" D=8/6/99 >A=100008 B="30" C="5" D=5/26/99 >A=100017 B="30" C="7" D=5/28/99 >A=100018 B="30" C="4" D=4/2/99 >A=100023 B="30" C="8" D=3/25/99 >NOTE: The DATA statement used 0.08 seconds. Just one of those stupid tricks >I learned while studying for the SAS Certification exam. >Rob Krajcik ABELSOR wrote: I have a file that contains data in this format, >e.g. "100002","30","3","4/21/99" >"100004","31","6","8/24/99" >"100006","30","1","8/6/99" >"100008","30","5","5/26/99" >"100017","30","7","5/28/99" >"100018","30","4","4/2/99" >"100023","30","8","3/25/99" I read it in giving each field 2 extra bytes in >length and then strip out the >double quotes with the COMPRESS function, but I'm sure there's a more >efficient >way (both in terms of storage and execution time). TIA Bob Abelson >Westat > Attachment Converted: "C:\ALNET_WS\EUDORA\ATTACH\robert.krajcik1.vcf"


Back to: Top of message | Previous page | Main SAS-L page