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

st: RE: Deleting variables for lack of observations


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: Deleting variables for lack of observations
Date   Thu, 27 Feb 2003 09:24:27 -0000

John Hennen
> 
> Joel Clovis wrote:
> 
> > I want to delete variables if they do not contain enough 
> observatoins.  I've
> > tried to make use of Nick Coxs'  npresent & dropmiss 
> (STB-49:dm67 &
> > STB-60: dm89)  to no avail, some attempts are in the 
> following manner:
> >
> > foreach var of varlist cba2tfina-region {
> >             keep `var' if r(npresent)>=30
> >     }
> 
> >
> > this brings up invalid syntax, and I'm not sure why
> >
> 
> REPLY-
> Assuming that the several variables in the varlist 
> cba2tfina - region are not
> strings, did you want something like this:
> 
> foreach var of varlist cba2tfina-region {
>             qui npresent `var'
>             replace `var' = .  if r(N) <30
>     }

This wasn't the original question. Setting variables 
to missing is not -drop-ping them. 

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