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

st: Re: Odd results from wordcount


From   "Michael Blasnik" <michael.blasnik@verizon.net>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Odd results from wordcount
Date   Fri, 19 Dec 2003 09:52:09 -0500

You should use:

local antvar: word count `varlist'

instead of the wordcount() function.  You must be using the non-SE version
of Stata which will truncate string function evaluations (involving an equal
sign) to 80 characters.

Michael Blasnik
michael.blasnik@verizon.net


----- Original Message ----- 
From: <steinar.fossedal@skandiabanken.no>
To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, December 19, 2003 8:54 AM
Subject: st: Odd results from wordcount


> Dear listers.
>
> I am in the process of writing a short program which will repeat multiple
> commands for many variables and combinations of variables. In general the
> user spesifies a variable list and commands, and the commands are repeated
> through all possible combinations of the variables.
> To run the loops the correct number of times I need to know how many
> variables are listed by the user. I do this through a wordcount of the
> variablelist. However, the wordcount seems to be unreliable. The program
> code and a transcript from part of the trace which illustrates the error,
> follows.
>
> Part of the program code looks like this:
>
> program redo
> syntax [varlist] [if] [in],cmds(namelist) [lhs(varlist)] [all] [savegraph]
> noisily display "varlist: `varlist'"
> noisily display "cmds: `cmds'"
> local antvar=wordcount("`varlist'")
> noisily display "antvar: `antvar'"
> .
> .
> .
> end
>
>
>


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