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

Re: st: Re: Recognizing the full length of a macro


From   Fred Wolfe <fwolfe@arthritis-research.org>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: Recognizing the full length of a macro
Date   Fri, 04 Mar 2005 07:55:28 -0600

Thanks.

In fact, that's what I ended up doing to accomplish my purpose: use the macro extended functions.

if "`var'" == "`:list pctvar & var'"{

Even so, perhaps index() should still report the correct index or, at the very least, inform us in the help files that it has this limitation,

Fred


At 07:42 AM 3/4/2005, you wrote:

Your wish is granted :)

Since Stata 8, you can get the length of a macro by using the macro extended function

local macrolen: length local macroname

I'm not sure why you need the index function given the variety of macro extended string functions available, especially the new(ish) family of macro list functions but also the subinstr, word count and word # functions.

type whelp macrolists and check out the functions there. Can you identify something you can't accomplish with the available functions?

Michael Blasnik
michael.blasnik@verizon.net

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761
fwolfe@arthritis-research.org


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