Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Odd behaviour of wordcount function


From   "Seed, Paul" <paul.seed@kcl.ac.uk>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Odd behaviour of wordcount function
Date   Thu, 2 Aug 2012 21:25:40 +0100

Many thanks Nick.  

Succinct and reliable as ever.
A pity the manual is not so clear.

The limit on `wordcount- (and string functions generally)
seems to be 254 characters. Longer than that, they are silently truncated.
This does not seem to apply to local and global macros, which can be extremely long.

BW

Paul

---------------------------------------------------

Date: Mon, 30 Jul 2012 11:45:48 -0500
From: Nick Cox <njcoxstata@gmail.com>
Subject: Re: st: Odd behaviour of wordcount function

- -wordcount()- is subject to a limit on length of input argument. You need

. display `: word count `vars''

See -help limits- and -help extended fcn-.

Nick

On Mon, Jul 30, 2012 at 11:36 AM, Seed, Paul <paul.seed@kcl.ac.uk> wrote:

> I have some 20 variable names in a local macro, called "vars" , and I want
> to know exactly how many there are. Why doesn't this work?
>
> . di wordcount("`vars'")
> 12
>
<SNIP>


Paul T Seed, Senior Lecturer in Medical Statistics, 
Division of Women's Health, King's College London
Women's Health Academic Centre, KHP
(+44) (0) 20 7188 3642.


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index