Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Aggregate constant to scalar and local


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Aggregate constant to scalar and local
Date   Fri, 13 Oct 2006 12:26:58 +0200

Stefan:
The following example shows one way to do that.

*------- begin example -----------
sysuse auto, clear
tabstat price, by(foreign) st(median) save
scalar `r(name1)' =  el(r(Stat1),1,1)
scalar `r(name2)' =  el(r(Stat2),1,1)

di scalar(Foreign)
di scalar(Domestic)
*---------- end example ---------

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

--- Gawrich Stefan wrote:
I want to obtain aggregate values (e.g. median age by sex) from an
individual data set and generate locals out of them (to show the values in a
textbox in a graph).

 

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