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

st: RE: selecting variables by their format


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: selecting variables by their format
Date   Wed, 14 Sep 2005 21:25:50 +0100

When you say "format", it appears that you mean "type". 
It really does help if you use terminology with some 
regard to what it means. 

. ds, has(type string) 

and 

. ds, has(type numeric) 

respectively leave behind in r(varlist) the list 
of variable names specified by the arguments given. 

This command is currently undocumented for 
reasons beyond this thread, but it is part of 
official Stata nonetheless. 

Nick 
[email protected] 

TEWODAJ MOGUES
 
> I have a quick question about how to select variables by 
> their format. 
> Suppose I want to drop (or rename, or do something else) with all 
> string variables. Clearly, 
> -drop if- doesn't work as that selects observations, not variables. 
> 
> The motivation for this question is that I want to collapse a whole 
> dataset by some variable: 
> collapse *, by(somevar)
> Specifically, I want to get the mean of all numeric variables by 
> somevar, and get the highest "value" in alphabetical order of the 
> string variables by somevar. So if there is no way to do this 
> in one go 
> using -collapse-, I would collapse separately for the numeric and the 
> string vars, and for that purpose I need to find a way to select 
> variables by their format.

*
*   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