Hello everyone, I am currently using hash objects to join tables and I would like to loop through 5 tables (e.g. Table_2010, ..., Table_2015) inside my DATA step. To do that, I would like to concatenante the loop counter with a string, let's say "Table_". My progress so far is the following : DATA TABLE_2010;
INPUT ID VAL;
DATALINES;
1 63
2 22
3 71
;
RUN;
DATA TABLE_2011;
INPUT ID VAL;
DATALINES;
4 68
5 55
6 54
;
RUN;
DATA RES;
DO i = 2010 TO 2011;
DO UNTIL (EOF) ;
SET 'TABLE_'&i END = EOF;
OTHER_VAL = CATS('TEST',i);
OUTPUT;
END;
END;
STOP;
RUN; This code doesn't currently work (otherwise I wouldn't be posting here) and I can see at least 3 issues : If I run this, the first error in the log indicates "Apparent symbolic reference i not resolved." The loop looks like it stops after 2010, I suspect EOF is the cause of this and should be replaced by EOF_2010 and EOF_2011. I'm not sure wheter STOP; instruction should be put before or after the END; of the outside loop. Replacing "TABLE_&i" with CATS("TABLE_",i) doesn't work either ("Invalid option name "TABLE_" error). I am kind of lost here and any help would be appreciated :).
... View more