Apr 23, 2010

Count Function in SAS 9...

Rather than using convoluted techniques to count the occurences of a word in a String…One can use the COUNT() function in SAS9 to get the results…
data _null_ ;
    sentence='Are you sure You are working to Learn SAS' ;
    num=count(sentence,'are','i') ;
    put num= ;
run ;
The results here is 2 …u guessed it right !!!