Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: 'Wildcard with exceptions' syntax


From   "Sergio Correia" <[email protected]>
To   [email protected]
Subject   Re: st: 'Wildcard with exceptions' syntax
Date   Fri, 29 Dec 2006 14:13:27 -0500

You can use the -unab- command (or tsunab if you are using time-series
operators), mixed with a macro function:

An example could be:

unab allvars : int_*
unab excludedvars : int_abc int_xyz
local selected : list allvars - excluded

And then you use the local macro -selected- like this:

reg y x1 x2 `selected'

You will see that the results do the same as (int_* - int_abc - int_xyz)

Cheers,
Sergio

PS: Its not in one line, but after you create the macro you can use it
everywhere, from summ to xtprobit

On 12/29/06, Kelvin Foo <[email protected]> wrote:
Dear Statalisters,

How can I do the following?

reg y x1 x2 (int_* - int_abc - int_xyz)

Obviously the above doesn't work.

"(int_* - int_abc - int_xyz)" is supposed to mean the varlist of all
variable names starting with int_ except int_abc and int_xyz, and in
place of int_abc and int_xyz could be any other variable names that I
specify.

I would need this syntax to be part of the varlist that goes with any
estimation commands such as -reg-, -probit-, etc.

Thanks.

Kelvin.
*
*   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/

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