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 (November 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 17 Nov 2008 13:40:48 -0500
Reply-To:     Hari Nath <hari_s_nath@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Hari Nath <hari_s_nath@YAHOO.COM>
Subject:      Re: Any easier way to count these.
Comments: To: "./ ADD NAME=data _null_;" <iebupdte@GMAIL.COM>

I only want to count the occurence of specific string. In my string, its only BND and BNID and i will ignore all others. Thanks.

On Mon, 17 Nov 2008 12:27:08 -0600, ./ ADD NAME=Data _null_, <iebupdte@GMAIL.COM> wrote:

>Do you want to count the number of occurrnce of specific string in >each row. In you exmple how many BND and BNIDs? Or do you want >counts all values from all variables? > >On 11/17/08, Hari Nath <hari_s_nath@yahoo.com> wrote: >> Hi all, >> Am trying to do some counting here and i had to use two count functions >> and also catx function for getting my final count. Is there any other way >> like array or any, so that i can reduce the number of functions here. The >> character variables range from a1 thru a15. >> >> Many thanks, >> hari. >> >> data have ; >> input a1 $ a2 $ a3 $ ; >> concat = catx(',',a1,a2,a3) ; >> cnt1 = count(concat,'bnd') ; >> cnt2 = count(concat,'bnid') ; >> cnt3 = cnt1 + cnt2 ; >> cards ; >> bnd bnid bnsr >> bnd bnd bnd >> bnid bnd >> ; >> run ; >> >> proc print ; >> run ; >>


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