Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: how to select all the numerical variable


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: how to select all the numerical variable
Date   Fri, 19 Jun 2009 19:30:50 +0200

<>

So to appl ythe solution to your problem:

***
sysuse auto, clear
qui ds, has(type numeric)
foreach var of varlist `r(varlist)'{
su `var', mean
replace `var'= `var'/100 if `var'<`r(mean)'
}
***


HTH
Martin
_______________________
----- Original Message ----- From: "Martin Wang" <zwang215@gmail.com>
To: "statalist" <statalist@hsphsun2.harvard.edu>
Cc: "zwang215" <zwang215@gmail.com>
Sent: Friday, June 19, 2009 7:06 PM
Subject: st: how to select all the numerical variable


Dear Statalist,

Can I ask a question? Is there any way that I can select all the numerical variable in a dataset? For example, I want to use:
for var equity net_income cash_fixinv : replace X=. if X==0.0001

But I have a lot of numerical variables like equity, net_income... but I don't want to list all of them. Is there any way to get around of this?

Many thanks in advance!

Martin



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index