Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: number of words in a text list


From   "Eric G. Wruck" <[email protected]>
To   [email protected]
Subject   Re: st: number of words in a text list
Date   Mon, 11 Jul 2005 15:52:00 -0400

How about the wordcount() function.  Here's an example:


. gen wordcount = wordcount(locations)

. l

     +----------------------------------------------------------------+
     |                                           locations   wordco~t |
     |----------------------------------------------------------------|
  1. |                     Alabama Delaware Kansas Wyoming          4 |
  2. |                Marburg Hachborn Hindelang Oldenburg          4 |
  3. | Rochester Ithaca Cambridge Wellesley Gahanna Bexley          6 |
     +----------------------------------------------------------------+


Later,

Eric



>also, is there a way to count how many WORDS are in a string without making a loop to go through the string and check that way ( I want something faster).
>thanks,
>Florence



-- 

===================================================

       Eric G. Wruck
       Econalytics
       2535 Sherwood Road
       Columbus, OH  43209

       ph:      614.231.5034
       cell:    614.330.8846
       eFax:    614.573.6639
       eMail:   [email protected]
       website: http://www.econalytics.com

====================================================
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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