Hi All,
I have 2 fields ( user name and user address in 1 table) and I have created another table after appending data from 32 text files containing data of different categories (e.g banks, loans, insurance) and that table would contain 2 fields ( 1st is data_field containing values ( from text files)) and flag field to identify from which text file the data is coming.
Now my aim is to create 2 new fields category and sub_category which would be based on below logic:
if (findstring(uppercase(username), data_field)>= 0 or findstring(uppercase(useraddress), data_field)>= 0) and flag = 'Bank'
THEN CATEGORY = 'Banking' and sub_category = 'Cards';
elseif ....
Now as there is no matching field to join the 2 tables and also with findreplace tool I can match only 1 field ( or part of field), so I am not able to fix this issue.
Below mentioned is sas code which I am trying to migrate to alteryx.
here file are various text files on the basis of which I am creating macro variables and using in condtions:
%macro string(file);
%global dd_&file.;
proc sql noprint;
select "index(upcase(bacs_user_nam),'"||trim(string)||"') or index(upcase(adr_l1),'"||trim(string)||"')"
into :dd_&file. separated by " or "
from &file.;
quit;
%mend;
%string(Banks);
data dd_categorisation;
set lookup.test;
if &dd_fuelcard. then do;subcat='Fuel Card';category='Cards';end;
else if &dd_buscard. then do;subcat='Business Card';category='Cards';end;
else if &dd_perscard. then do;subcat='Personal Card';category='Cards';
---
run;