Date: Sat, 13 Nov 2004 23:28:33 -0500
Reply-To: George Lesny <royal_dorado@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: George Lesny <royal_dorado@YAHOO.COM>
Organization: Bell Sympatico
Subject: Counting number of occurences of a pattern in a string
We are using SAS version 8 and I need to modify a SAS program to do a
pattern search on a given string and count the number of occurrences. I am
new with SAS and after much struggling am not able to get any results.
For example, if a string "ABCcccABCdddABCfff" is passed into the program, I
would like to do a search of a pattern "ABC" within that string (for each
row individually within the file) and return the total count of the pattern
match within the string. This means that in the example above if the syntax
were code_count = count(string, 'ABC'), then code_count would be set to 3.
I tried to use the count function but it appears that this is only available
with version 9...
Any help would be greatly appreciated!