Statalist


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

st: Generating values relative to a base year for several variables


From   "Hugh Colaco" <[email protected]>
To   statalist <[email protected]>
Subject   st: Generating values relative to a base year for several variables
Date   Wed, 11 Jun 2008 15:18:28 -0400

Hi Statalist,

I am trying to generate the following output:-

Obs #	BaseYear	ret3_1	ret3_2	ret3_3
1	1991	13.86	3.76	45.34
2	1993	-26.36	......	......
3	1992	1.9	6.16	......


............given the following data:-

Obs #	BaseYear  data3_1991  data3_1992  data3_1993  data3_1994
..............data3_1997

1	1991                0	        13.86            3.76            45.34
     ......................

2	1993	        .                    .             35.19
8.83      ......................

3	1992	         .                    0	              1.9	6.16
.......................

Note the following:-

1) As shown in the output, I want the difference between the values of
the subsequent years and the base year. For example, Obs # 1 has a
BaseYear of 2001. So, ret3_1 = data3_1992 - data3_1991. Similarly,
ret3_2 = data3_1993 - data3_1992.  I want this to be done for only 3
years from the BaseYear for each observation. I have only shown data
up to 1994 because of space constraints. However, I have data up to
1997. Therefore, a firm with BaseYear 1994 would be covered up to
1997. As a result, there will be NO missing values in the output table
(even though right now you see  "..... " for Obs # 2 and 3.

2)  I need the same procedure above to be done for variables "data6,
data8, data46" for the same years (i.e. 1991-1997).

Thanks in advance,

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