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

Re: st: RE: Macro questions. (Again).


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: RE: Macro questions. (Again).
Date   Wed, 11 Aug 2004 10:12:13 -0400

Amadou wrote:

At 08:27 AM 8/11/2004 -0400, you wrote:
Nick,
When I talk about working inside macros, I am thinking of something
like this:
I know that one can increment a macro by doing: local myvars "`myvars' var1"
But why can't we REMOVE var1 from the macro myvars?
Something like (it's just an example, but maybe you have another syntax):

local myvars "`myvars' , -var1"

(where -var1 is intented to tell Stata to remove var1 from myvars).
[...]
You should check -help macrolists-, in particular, you would want...
 local toremove "var1"
 local myvars: list myvars - toremove

to do what you meant by...
 local myvars "`myvars' , -var1"

You could also use a separate name, if you prefer:
 local mynewvars: list myvars - toremove

But do see -help macrolists- for a large set of macro list operations.

I hope this helps.
-- David


David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404

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