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 <[email protected]>
To   [email protected]
Subject   Re: st: Re: Recognizing the full length of a macro
Date   Fri, 04 Mar 2005 07:55:28 -0600


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,


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
[email protected]

Fred Wolfe
National Data Bank for Rheumatic Diseases
Wichita, Kansas
Tel (316) 263-2125     Fax (316) 263-0761
[email protected]

*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index