"when I try to replace A and B using libname.dataname--there are syntax errors. Also, lib.data2 include B but also other variables that's not in the variable --how can I address that?"
Post your code and Log (Error) Information .
"Moreover, for my table A : it's 4*8 b/c there are only 4 types. for my table B: there are 500k rows while each row has a type in the type column, thus the dimension is 500k*length(duration). Is there still a way to calculate it?"
Then IML still can work on that , but need some more code .
Post some data and the output you want to get to explain your requirement if you really want IML code .
Or just try Data Step .
... View more