Hi Nick,
Thanks a lot for the link and the codes, especially the -missing- command.
Now I can pry myself off the chair and leave my office!!
Cheers,
Ada
Nick Cox wrote:
There are several ways to do this.
One is
. ds <varlist>, not
This returns all variables _except_ those
in <varlist>, after which you can go
foreach v of var `r(varlist)' {
...
}
Also look at the options of -ds-.
Another is to use the facilities in
-macrolists-. See -whelp macrolists-.
For what looks like your particular
problem here, check out
http://www.stata.com/support/faqs/data/missing.html
Nick
[email protected]
-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Ada Ma
Sent: 11 May 2004 19:29
To: [email protected]
Subject: st: selecting all variables but a few
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/