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" <>
To   <>
Subject   st: RE: Aggregate constant to scalar and local
Date   Fri, 13 Oct 2006 12:26:58 +0200

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


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

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

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