LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (October 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 20 Oct 2006 12:09:56 -0700
Reply-To:     newbie <itissandeep@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         newbie <itissandeep@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Counting number of delimiters in each record
Comments: To: sas-l@uga.edu
In-Reply-To:  <16FD64291482A34F995D2AF14A5C932C015A6D3B@MAIL002.prod.ds.russell.com>
Content-Type: text/plain; charset="iso-8859-1"

What is the max length of a string in SAS ? Because I tried the same with a string length of 32767 length oneline $32767; And yet, it doesn't completely read the record. I have the number of fields of the order of 2000 in a csv file with spaces in between for some fields.

thanks and regards

"Terjeson, Mark" wrote: > Hi, > > An example of doing so is: > > > filename yourfile 'C:\yourpath\yourcsv.csv'; > > * read varying length records ; > data myfile(keep=theline fieldcount); > length theline $2000; > infile yourfile length=lenvar; > input @1 theline $varying. lenvar; > fieldcount = length(theline) - length(compress(theline,',')) + 1; > run; > > > > Hope this is helpful. > > > Mark Terjeson > Senior Programmer Analyst, IM&R > Russell Investment Group > > > Russell > Global Leaders in Multi-Manager Investing > > > > > > > -----Original Message----- > From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of > kenneth_m_lin@SBCGLOBAL.NET > Sent: Friday, October 20, 2006 11:39 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: Counting number of delimiters in each record > > Why can't you read in each record as a single string and parse it to see > how many commas are there? > > "newbie" <itissandeep@gmail.com> wrote in message > news:1161311099.632231.14280@f16g2000cwb.googlegroups.com... > >I have a large dataset (csv file) with varying number of fields. > > How can I count the number of commas in each record and store them ? > > > > Thanks and Regards > >


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