Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: How to standardize a variable with a define mean


From   Alberto R Osella <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: How to standardize a variable with a define mean
Date   Wed, 01 Feb 2012 10:44:25 +0100

Dear Statalisters,
I want to standardize a variable (BMI) with a given mean value. I've obtained that value from a -summarize- command, that is r(mean). Now I want to pass the value of r(mean) to the egen command. Here the commands and the error returned by Stata.

. sum BMI
. scalar meanbmi=r(mean)
. display meanbmi
25.8435
. egen stdbmi=std(BMI), mean(meanbmi) std(1)
option mean() incorrectly specified
r(198);

I'd want to do this automatically. Can someone help me?
Thank you in advance

--
Alberto R. Osella, MD, PhD
Laboratorio di Epidemiologia e Biostatistica
IRCCS Saverio de Bellis
Via Turi, 27
70013 Castellana Grotte (BA)
Italia
Tel:    +39 0804994655
Fax:    +39 0804994650
e-mail: [email protected]

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index