Dear Statalisters,
I have a string variable. Each observation includes a different number
of words separated by a special character, say a slash or a space
(e.g."HOUSE COFFEE MILK").
I need to count the number of words in each cell (in this case it would be 3).
I thought that one possibility would be find a command that counts the
number of spaces in the cell (in this case it would be 2) and then add
1 in the end to have the number 3 I want. Do you know about such a
command, which counts the number of spaces or special characters in a
cell?
Otherwise, any other command that fits my case would be fine. Do you
have any suggestions?
Thank you very much in advance!
AR
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/