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   "Michael Blasnik" <[email protected]>
To   <[email protected]>
Subject   Re: st: Re: Recognizing the full length of a macro
Date   Fri, 04 Mar 2005 09:38:54 -0500

I Agree-- it should be made more clear that all of the "regular" string functions (those used with = ) can/will return incorrect results when used on text strings longer than the maximum allowed string variable length. Perhaps they should just include a line in the help file stating that they are not intended for use on macros.

Michael Blasnik
[email protected]


----- Original Message ----- From: "Fred Wolfe" <[email protected]>
To: <[email protected]>
Sent: Friday, March 04, 2005 8:55 AM
Subject: Re: st: Re: Recognizing the full length of a macro



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

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