Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

st: RE: nested calculations


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: nested calculations
Date   Fri, 3 Dec 2010 12:20:32 +0000

. help collapse 

Nick 
[email protected] 

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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index