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

Re: st: Create variables from the results of 'svymean'


From   Dan Blanchette <[email protected]>
To   [email protected], "Ueda, Takeshi (FAORAP)" <[email protected]>
Subject   Re: st: Create variables from the results of 'svymean'
Date   Wed, 24 Nov 2004 11:37:08 -0500 (EST)

You can save the results from -svymean- to a new matrix and then use that
matrix to solve your problem:

. svymean ss1 ss2 ss3

. ereturn list

. matrix list e(b)

. matrix means = e(b)

. matrix list means

. display "gen z= " means[1,1] "*" means[1,2] "*" means[1,3]

. gen z= means[1,1]*means[1,2]*means[1,3]

. matrix drop means

Dan Blanchette
Applications Analyst Programmer
Carolina Population Center UNC-CH
[email protected]



Takeshi wrote:
---------------------------------------------------------------------------------------
Please tell me how I can create variables from a result of 'svymean'.  What is done in the appended simple program is first running the program up to the line "svymean ss1 ss2 ss3" to get results, which can be seen in Stata Results Window, and subsequently punching the numbers into the program using 'gen' command.  Is there a way that I can directly use the results of 'svymean' without defining the results as new variables? Thank you for your advise in advance.

**************************
svyset [pweight=weind]

svymean ss1 ss2 ss3

drop ss1-ss3

gen sw1=.0043243
gen sw2=.0006317
gen sw3=.0006557

svyset, clear(iweight)

gen z = sw1*sw2*sw3

******************************************


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