Statalist


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

Re: st: Count special characters in a cell


From   "Philipp Rehm" <[email protected]>
To   [email protected]
Subject   Re: st: Count special characters in a cell
Date   Sun, 06 Sep 2009 18:04:54 +0200

.
How about:

sysuse auto, clear
gen count=wordcount(make)
list count make


HTH,
Philipp

-------- Original-Nachricht --------
> Datum: Sun, 6 Sep 2009 17:46:14 +0200
> Von: Andrea Rispoli <[email protected]>
> An: [email protected]
> Betreff: st: Count special characters in a cell

> 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/

-- 
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/atbrowser
*
*   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