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

RE: Re: st: drop exact name only


From   "Nick Cox" <[email protected]>
To   <[email protected]>, <[email protected]>
Subject   RE: Re: st: drop exact name only
Date   Fri, 9 Aug 2002 19:35:58 +0100

I wrote 
> 
> Here is a stab at the problem from another angle: 
> 
> program def fussydrop
> *! NJC 1.0.0 9 August 2002 
> 	version 7 
> 	syntax varname 
> 	args myvar garbage 
> 	if "`garbage'" != "" { error 198 } 
> 	confirm var `myvar' 
> 	if "`varlist'" == "`myvar'" { drop `myvar' } 
> end 
> 

The `garbage' bit is garbage. The program 
will throw you out if there is any trailing garbage
because it won't match the -syntax- statement. 
And similarly -confirm-. 

program def fussydrop
*! NJC 1.1.0 9 August 2002 
 	version 7 
 	syntax varname 
 	args myvar 
 	if "`varlist'" == "`myvar'" { drop `myvar' } 
end 
 
Nick 
[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