(1) How do I generate a new variable in a dataset that is equal to the
observations number? eg. suppose have data like:
var1 var2
12 43
12 23
. .
. .
1 32
how do I create a new variable, t, that is 1 for the first observation, 2
for teh second, 3 for the third, etc.?
(2) I am using the stata -rolling- command (new to stata 9) to generate
rolling correlations. if i declare my data set to be a time sereis dataset
using the date variabe (format: %dD_m_Y) it doesn't work. however, when i
use a new variable for observations (eg. like the one above, where it equals
1 for the first obs, 2 for the second observation, ...) and declare the data
to be time series (tsset) on this variabel, it works. Why?
(3) also, can you refere me to a good site where i can get more information
on writing loops?