I have two sets of column names in my database such as columnA_1, columnA_2 ... all the way till 17. And another column name like columnB_1, columnB_2... all the way to 9. I want to create a new variable that checks if these columns have same values (character) and how many of them have same values. For Example consider the following table: A_1 A_2 A_3 A_4 B_1 B_2 B_3 B_4 John Adam David Sam Adam John Matt Tom In the above data, I want the code to check all the columns from A_X with values of columns in B_X and give me a number = 2. i.e Adam and John is common between them. This is the code I am trying but is not working at all. I am not an expert in SAS so I am learning by doing but am unsuccessful so far. Any help is appreciated.
%macro create(adv);
data nestedcommon2;
set nestedcommon1;
%do i=1 %to 17;
%do j= 1 %to 9;
common=0;
%if acq_adv_&i=tar_adv_&j %then common = common+1;
%end;
%end;
final=common;
run;
%mend create;
%create(153) Thanks, Mjizzle
... View more