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

RE: st: easy question:standardizing variables

From   "Frank de Libero" <>
To   <>
Subject   RE: st: easy question:standardizing variables
Date   Sun, 29 Dec 2002 18:10:41 -0800

Couple additional comments to Fred's response.

It is basic once you know how. A little time invested in learning
the -foreach- and -forvalues- will pay you back major dividends. In the
Stata Journal, Vol 2, No 2, Nick Cox wrote an excellent article walking one
through macros and these commands, including some of their subtleties.
(There may be a FAQ also.) You would do well to study Nick's article. Also,
you do have available to you the Stata list conventions if you want to use
them (e.g., foreach var of varlist * {  etc.).

Happy New Year to you, too!


-----Original Message-----
[]On Behalf Of Fred Wolfe
Sent: Sunday, December 29, 2002 5:54 PM
Subject: Re: st: easy question:standardizing variables

At 07:48 PM 12/29/2002 -0600, you wrote:
>I know this is a really basic question, but I really can't figure something
>I want to standardize the variables in my dataset (there are 36) without
>typing "egen zvar1=std(var1)" 36 times.

foreach var of varlist var1 var2 var3 varn {
   egen z`var'=std(`var')

Fred Wolfe

Fred Wolfe                                                          Tel
(316) 263-2125
National Data Bank for Rheumatic Diseases         Fax (316) 263-0761

*   For searches and help try:

*   For searches and help try:

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