Hello I'm looking to create a new column in my dataset that counts the number of times a specfic word appears in a string. The words are separated by "*" in each row.
Output should be
Animal List Dog Count
1 dog*dog*cat*bird*dog 3
2 dog*dog*cat*bird*dog*dog 4
Can provide additional information if needed.
The following formula will find all items with the string "dog" found in it
wordList=words(st,"*"); count=0;for(i=1,i<=n items(wordList),i++,count=sum(count,contains(wordList[i],"dog"))); count;