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 at the end of May, and its replacement, statalist.org is already up and running.


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

st: RE: nested calculations


From   Nick Cox <n.j.cox@durham.ac.uk>
To   "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu>
Subject   st: RE: nested calculations
Date   Fri, 3 Dec 2010 12:20:32 +0000

. help collapse 

Nick 
n.j.cox@durham.ac.uk 

Fabio Zona

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