Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: nested calculations


From   Fabio Zona <fabio.zona@unibocconi.it>
To   statalist@hsphsun2.harvard.edu
Subject   st: nested calculations
Date   Thu, 2 Dec 2010 22:04:21 +0100 (CET)

Hi All,
I have another little problem: promise it is the last one for today! 

I have the list below. For each firm, I have to calculate the standard deviation for every variable (e.g., for Var 1) referring to the 4 quarters of each year!
Below you find both the starting matrix and the expected one.

Please, help! (I think this might be easier)


STARTING MATRIX OF VAR/OBS
firm   year  quarter  	Var1	Var2
1	1	1		
1	1	2		
1	1	3		
1	1	4		
1	2	1		
1	2	2		
1	2	3		
1	2	4		
1	3	1		
1	3	2		
1	3	3		
1	3	4		
2	1	1		
2	1	2		
2	1	3		
2	1	4
2	2	1
2	2	2
2	2	3
2	2	4
2	3	1
2	3	2
2	3	3
2	3	4



EXPECTED MATRIX OF VAR/OBS
firm   year  stddev_Var1
1       1        number
1       2
1       3
2       1
2       2
2       3



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