Date: Fri, 28 Oct 2005 06:11:04 -0700
Reply-To: chris@OVIEW.CO.UK
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: chris@OVIEW.CO.UK
Organization: http://groups.google.com
Subject: Re: Counting Words in a Text String
Content-Type: text/plain; charset="iso-8859-1"
Heh heh. I read this thread thinking "not that old chestnut again",
only to find that not only was it the same old chestnut, but Richard
has quoted my first response to the question from nine years ago!
By the way, you can handle the null string case and still do it on one
line:
numwords = (string ne " ") * (1 + length(compbl(string)) -
length(compress(string)));
Chris.
--------------------------------------------------------
Elvis SAS Log Analyser - http://www.oview.co.uk/elvis
--------------------------------------------------------
|