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

st: selecting all variables but a few


From   Ada Ma <[email protected]>
To   [email protected]
Subject   st: selecting all variables but a few
Date   Tue, 11 May 2004 19:29:18 +0100

Hello Statalist,

I want to do something like this:

foreach var of varlist * {
replace `var'=`var'[_n-1] if pid==pid[_n-1] & `var'==.
replace `var'=`var'[_n+1] if pid==pid[_n+1] & `var'==.
}

My problem is that I have a large number of variables in my dataset and I don't want my commands to be applied to ALL variables. What commands can I use to select all variables but a few?

Many thanks in advance.

Ada





--
Ada Ma
Research Assistant
Department of Economics
University of Aberdeen Business School
Edward Wright Building F55
http://www.abdn.ac.uk/economics/
http://www.abdn.ac.uk/~pec187/firstpage.htm
Tel: +44 1224 273417
Fax: +44 1224 272181
Email: [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