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: How to use an independent grid to perform calculations for each observations


From   Daniel Almar de Sneijder <dasneijder@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: How to use an independent grid to perform calculations for each observations
Date   Wed, 10 Oct 2012 15:21:36 -0400

Hello Stata,

Does anybody perhaps know a way to perform calculations for each
observant using a grid. More specific,

I have variables that record the earnings of respondents, say
RwIEARN50 ... RwIEARN99.
I want to index these variables by using a grid. The trick is however
that each observation refers to respondents. Each respondent has a
different year of birth and year of eligibility and therefore a
different indexing factor needs to be used.

So basically I have a N-by-M matrix, call it S, with on the rows the
indexing factor of the earnings at each year i = 1,...,N and on the
columns the year eligibility j = 1,...,M

Now I want to construct variables RwINDEX50 ... RwINDEX99 that record
the indexing factor for all respondents 1....R (rows), which basically
depend on the year of eligibility of each respondent and the name of
the variable (50...99).

In formula, this would correspond to:

year of eligibility = date of birth of `r' + 62
replace RwINDEX`year'[`r'] = S[`year']['year of eligibility']


Basically this is something very simpel that can be done within 5
minutes with Matlab. In STATA however this looks like impossible?

Thank you for the input.

Regards,
Daniel
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index