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 (September 2008, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Tue, 30 Sep 2008 13:21:59 -0700
Reply-To:     Learner <pradev@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Learner <pradev@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: Total count
Comments: To: sas-l@uga.edu
Content-Type: text/plain; charset=ISO-8859-1

On Sep 30, 11:52 am, sash...@BELLSOUTH.NET (Paul Dorfman) wrote: > As Art has implicitly pointed out, for countW() to work, the words do not > have to be necessarily separated by blanks; commas are fine, too: > > count = countW (abc) ; > > A cursory look at the countW() doc on the web > > http://support.sas.com/documentation/cdl/en/lrdict/59540/HTML/default... > 77495.htm > > reveals that other default delimiters, pretty much in the same vein as > with the scan() function, will work as well, or can be specifically > indicated, as in > > countW (abc, ',') ; > > Plus, the function allows a whole slew of modifiers. > > Kind regards > ------------ > Paul Dorfman > Jax, FL > ------------ > > On Tue, 30 Sep 2008 11:42:20 -0400, Paul Dorfman <sash...@BELLSOUTH.NET> > wrote: > > > > > > >Pradev, > > >count = countW (translate (abc, '', ',')) ; > > >should work in 9.1.3 and on. Also, > > >count = countC (abc, ',') + 1 ; > > >will work as well, albeit it can be duped by duplicate consecutive commas > >between the words as in "abc,, def, ijk,,, xy, z". If all the commas are > >single, countC() appears to be a more direct path. > > >If you are still with Version 8 (some shops still are), find the old > macro- > >style function %nwords() in the sas-l archives and use > > >translate (abc, '', ',') > > >as its argument. > > >Kind regards > >------------ > >Paul Dorfman > >Jax, FL > >------------ > > >On Tue, 30 Sep 2008 08:22:01 -0700, Learner <pra...@GMAIL.COM> wrote: > > >>Hi all, > > >>I have 5-10 names in each observation for a variable ABC seperated by > >>a comma. > > >>eg: > >> ABC > > >>1. amy, jones, cinty, doug, ford > >>2. louis, amy, tom, tim, jim, wang, heather, carole. > >>3. cinthia, soniya, john, lori > > >>I have to count them and have to give a total number of names in each > >>observation in a seperate variable COUNT. Can someone please help me > >>how to do that. > > >>Thanks, > >>Pradev- Hide quoted text - > > - Show quoted text -

Thank you all -Pradev


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