forvalues i = 1/n {
gen vol`i' = length`i' * breadth`i' * height`i' * _pi / 6
}
The problem is that this measurement is performed a number of
times for each mouse on different days so that I'd need
length1.....lengthn
breath1... etc.
gen volumem=lengthm*.....
What you are describing is a relational database in which the fixed
characteristics of each mouse are stored in each table, with a
mouse_id identifying them, and another table in which you have the
time-varying measurements (perhaps weight of the mouse or how much it
ate today), again identified with mouse_id and some kind of
timestamp. In a RDBMS you would then join those two tables when you
needed to juxtapose all of the characteristics. In Stata terms, that
would suggest
Then any time you want to combine the two tables you just merge them:
use mouse2
merge using mouse1, uniqusing
which appends the fixed characteristics to each record in the time-
varying dataset.
See my FAQ about appending group characteristics to individual level
data. This is essentially the same problem: for group read mouse and
individual read mouse-measured-at-time-t.