Hi Folks,
Just one small ask. Please help.
I am running the below code with the following values, but the output is catching one account extra in not_in_emp_accounts.
data have;
input Emp_Accounts :$200. Sales_Accounts :$200. ;
put (_all_) (=);
datalines;
239684,239789,240173,240262,240760,241149,241175,241240,241249,241691,241750 240740,241149
run;
data want (drop=i);
set have;
length not_in_sales_accounts not_in_emp_accounts $200;
do i=1 to countw(emp_accounts);
if findw(sales_accounts,scan(emp_accounts,i,',')) = 0 then
not_in_sales_accounts=catx(',',not_in_sales_accounts,scan(emp_accounts,i,','));
end;
do i=1 to countw(sales_accounts);
if findw(emp_accounts,scan(sales_accounts,i,',')) = 0 then
not_in_emp_accounts=catx(',',not_in_emp_accounts,scan(sales_accounts,i,','));
end;
run;
The output is coming like below:
not_in_sales_accounts not_in_emp_accounts 239684,239789,240173,240262,240760,241175,241240,241249,241691,241750 240740,241149
But you can see that 241149 is already present in emp_accounts.
Rather the output should come:
not_in_sales_accounts not_in_emp_accounts 239684,239789,240173,240262,240760,241175,241240,241249,241691,241750 240740
I hope you got my point. Can you please explain why it's catching the common account which is already present in both especially in this case?
Please help. Thanks in advance.
... View more