Dear all
I have stacked data on 53 subjects and for each subject 11 observations, every subject has an id number. I would like to create a matrix for two variables, qrisk and qreturn, for each subject. This should yield 53 11x2 matrices.
I wrote the following loop but I am stuck with the naming.
The loop does execute but I cannot retreive the matrices. Since the id variable goes from 1 through 53 I assumed the names for the matrices would become Q1 through Q53. However:
says there is no matrix with this name.
Am I using the wrong loop here?
Thanks in advance.
Arthur
I have stacked data on 53 subjects and for each subject 11 observations, every subject has an id number. I would like to create a matrix for two variables, qrisk and qreturn, for each subject. This should yield 53 11x2 matrices.
I wrote the following loop but I am stuck with the naming.
Code:
foreach i in id { mkmat qrisk-qreturn if id==`i', matrix(Q`i') }
Code:
matrix list Q1
Am I using the wrong loop here?
Thanks in advance.
Arthur
Comment