I've been trying to rename a set of variables from a scale using arrays and DO loops, but without success. This seems like a very simple task. Any advice on where I'm going wrong?
ARRAY ATRSS (i) ATRSS_1 ATRSS_12 ATRSS_13 ATRSS_25 ATRSS_29 ATRSS_30 ATRSS_32 ATRSS_33 ATRSS_35 ATRSS_36;;
Array DIS (10) $ DIS1-DIS10;
DO i = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10;
DIS (i) = ATRSS(i);
END;
I get the error: Mixing of implicit and explicit array subscripting is not allowed.
Thanks!
array atrss atrss_1 ... ;
Remove the (i) from the first line and you're fine.
I would note that you're not renaming, per se - you can't do a rename that way - but of course it accomplishes the same goal.
You can improve this further, although it works okay as is:
That makes it slightly more flexible, if you change the number of elements in atrss.
do i = 1 to 10;
is also acceptable - much easier than spelling them each out, anyway.