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 (May 2011, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 25 May 2011 08:39:09 -0700
Reply-To:     "Jfh@alumni.stanford.org" <jfh@STANFORDALUMNI.ORG>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Jfh@alumni.stanford.org" <jfh@STANFORDALUMNI.ORG>
Subject:      Re: How to count the number of a particular character in a
              string?
Comments: To: "DUELL, BOB (ATTCINW)" <bd9439@ATT.COM>
In-Reply-To:  <AC5F423B9AB19C43BE62C86BAF8113CC083EFC@WABOTH9MSGUSR8C.ITServices.sbc.com>
Content-Type: text/plain; charset=UTF-8

Have you looked at the CountC function? -- Sent from my Android phone with K-9 Mail. Please excuse my brevity.

"DUELL, BOB (ATTCINW)" <bd9439@ATT.COM> wrote:

Hi, I was asked today how to count how many of a particular character was in a string and came up with the following: data _null_; tester = 'alphabet characters'; do check_for = 'a','z'; count = ifn(index(tester,check_for),length(compress(tester,check_for,'k')),0); put check_for= count=; end; run; This certainly works but it involves a lot of function calls. Any better (more efficient) ideas? Thanks, Bob


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