Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Odd behaviour of wordcount function

From   "Seed, Paul" <>
To   "" <>
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.




Date: Mon, 30 Jul 2012 11:45:48 -0500
From: Nick Cox <>
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-.


On Mon, Jul 30, 2012 at 11:36 AM, Seed, Paul <> 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

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:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index