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>
Subject: Re: Counting number of delimiters in each record
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
thanks and regards
"Terjeson, Mark" wrote:
> 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;
> Hope this is helpful.
> Mark Terjeson
> Senior Programmer Analyst, IM&R
> Russell Investment Group
> Global Leaders in Multi-Manager Investing
> -----Original Message-----
> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
> 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" <firstname.lastname@example.org> wrote in message
> >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