Searching is the most wildely used technology.It includes:merges,joins,formats,indexs and other special functions.
The skills about merge,sql and conditional logic are all base on comparsion.Because it need to compare key with one or more keys in another table,it is slow and it would spend a lot of memory.What is more,if you use merge,you have to sort the data first.If the data happen to be a large data,the Merge method would be the worst.
Hashing is better method base on Direct-Addressing and it is much more convenient.
The is a Demo using hash.You can try it in another way like sql,merge to compare their efficiency.
复制代码
Table A is the main dataset,The question is you need the replace the variable 'type' using table B.For example using 'xy' to replace 'a'.As a result,the first line would be:
复制代码
The solution I will post later.welcome disscusion.
data c;
set a;
length str $100;
k = 1;
str = "";
do while (scan(type, k, ',') ne "");
if k=1 then str = symget(scan(type, k, ','));
else str = strip(str)||","||symget(scan(type, k, ','));
k = k + 1;
end;
drop k;
run;