Statalist The Stata Listserver


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

st: RE: reshaping a cross table on several indicators


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: reshaping a cross table on several indicators
Date   Thu, 18 Jan 2007 14:00:31 -0000

bysort cat year : egen meanx = mean(x)
by cat year : egen meany = mean(y)
by cat year : egen meanz = mean(z)
egen tag = tag(mean year) 
list cat year mean? if tag 

Nick 
[email protected] 

FUKUGAWA, N.

> i made cross table on indicators x, y, and z.
> 
> table cat year,c(mean x mean y sum z) m f(%5.2f)
> 
> 	year
> cat	1983	1984	1985
> a	1	2	3
> 	4	5	6	
> 	.	.	.	
> b	10	20	30
> 	40	50	60	
> 	70	80	90	
> c	100	200	300
> 	.	.	.
> 	700	800	900
> 
> how can i convert this table as follows?
> 
> cat	year	x	y	z
> a	1983	1	4	.
> 	1984	2	5	.
> 	1985	3	6	.
> b	1983	10	40	70	
> 	1984	20	50	80
> 	1985	30	60	90
> c	1983	100	.	700
> 	1984	200	.	800
> 	1985	300	.	900
*
*   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