Thank you, Meg, Vladimir, and Jeff for your help!
On 25/03/2008, Margaret R Grove <[email protected]> wrote:
> Hi,
>
> Here's one method:
>
> unab vlist: _all /* assign all variable names to local variable
> vlist */
> foreach x of varlist `vlisit' {
> capture confirm string variable `x'
> if _rc~=0 {
> /* do numeric variable processing here */
> }
> else {
> /* do string processing here */
> }
> }
>
> Meg
>
>
> Libby Hemphill wrote:
> > Hi,
> >
> > I'm wondering if there's a way to loop through all my variables and
> > perform some action only on those that are numeric. Is there a way to
> > check for the type of the variable before doing something? Like
> >
> > for each variable
> > if string, next
> > else do X
> > end for
> >
> > Thanks!
> >
> >
>
> *
> * 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/
>
--
Libby Hemphill
Doctoral Candidate
School of Information
University of Michigan
http://www.libbyh.com
*
* 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/