Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Count special characters in a cell


From   Andrea Rispoli <[email protected]>
To   [email protected]
Subject   st: Count special characters in a cell
Date   Sun, 6 Sep 2009 17:46:14 +0200

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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index