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.
I only want to count the occurence of specific string. In my string, its
only BND and BNID and i will ignore all others.
On Mon, 17 Nov 2008 12:27:08 -0600, ./ ADD NAME=Data _null_,
>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 <firstname.lastname@example.org> 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
>> like array or any, so that i can reduce the number of functions here.
>> character variables range from a1 thru a15.
>> Many thanks,
>> 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 ;