Statalist The Stata Listserver


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

Re: st: RE: excluding variables from varlist


From   "David Elliott" <[email protected]>
To   [email protected]
Subject   Re: st: RE: excluding variables from varlist
Date   Fri, 26 May 2006 10:35:55 -0300

If there was a large number of variables one could also use an: if
inlist("`var'","a","b"...up to 10 varnames) and this could be repeated
with an or.

I am assuming one would use this to cycle through all categorical
variables excluding the measure variables or vice versa.

DCE

On 5/24/06, Alex Ogan <[email protected]> wrote:
There's likely a better way, but I often do this:

foreach each var of varlist _all {
        if "`var'" == "a" continue
        if "`var'" == "b" continue

        <whatever>
}

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Thomas
Sent: Wednesday, May 24, 2006 12:59 PM
To: [email protected]
Subject: st: excluding variables from varlist

Hi,

using the foreach command I would like to exclude certain variables,
e.g:
"foreach var of varlist _all [/excluding a, b, c/]".

Is that possible and if so how?

Thanks,

Thomas

--
______________________________
Thomas Triebs
Research Assistant
Electricity Policy Research Group
Faculty of Economics
University of Cambridge
Sidgwick Avenue, Austin Robinson Bldg.
Cambridge CB3 9DE
United Kingdom
Phone: +44-1223-335287
Fax: +44-1223-335299
http://www.econ.cam.ac.uk
http://www.electricitypolicy.org.uk

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


This message is intended solely for the designated recipient(s). It may contain confidential or proprietary information and may be subject to confidentiality protections. If you are not a designated recipient, you may not review, copy, or distribute this message. If you receive this in error, please notify the sender by reply e-mail and delete this message.

Arrowstreet Capital, L.P. is an Equal Opportunity Employer.



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



--
David Elliott

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