Memory wise everything is stored contiguously, the two dimensions are just a pictorial view of the vector in a tabular form.
Another way (beside the explicit association of named variables) would be to transform the two dimension address to a single one.
[pre]d1,d2 = (d1-1)*max(d2)+d2[/pre]
so, for a 2,5 vector, for example:
1,2 becomes (1-1)*5+2=2, thus X2
1,5 becomes (1-1)*5+5=5, thus X5
2,3 becomes (2-1)*5+3=8, thus X8
2,5 becomes (2-1)*5+5=10, thus X10
you could code this into a macro like this:
[pre]%macro i(D1,D2,MAX_D2);
%sysevalf( (&D1-1)*&MAX_D2+&D2)
%mend i;[/pre]
then you just have to reference each variable using the macro, this way:
[pre]X%i(1,2,5)=10000; * which resolves to X2;
X%i(1,5,5)=10001; * which resolves to X5;
X%i(2,3,5)=10002; * which resolves to X8;
X%i(2,5,5)=10003; * which resolves to X10;[/pre]
Cheers from Portugal
Daniel Santos @
www.cgd.pt