- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I need a help matching columns. Column A and B has names, I want to match names in Column B. If column B name matches with Column A (any order or any part is fine from Col A), need to create a flag with Y or N. Column B name must match exactly with Column A . I tried with SCAN function and few other functions. Proc sql also will work for me. Column A has 1- 6 names. Column B has 1-4 names.
Data Have
Column A Column B
CAMACHO ANAYA FAIBER ANAYA
EVER ANDRES NAVARRO Navas MELO Navarro Navas
EVER ANDRES NAVARRO MELO Navarro Navas
PINILLA AGUDELO JOVANNY PINIL
PINILLA AGUDELO JOVANNY PINILLA
Data Want
Column A Column B Flag
CAMACHO ANAYA FAIBER ANAYA Y
EVER ANDRES NAVARRO Navas MELO Navarro Navas Y
EVER ANDRES NAVARRO MELO Navarro Navas N
PINILLA AGUDELO JOVANNY PINIL N
PINILLA AGUDELO JOVANNY PINILLA Y
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
input Column_A $40. Column_B $20.;
cards;
CAMACHO ANAYA FAIBER ANAYA
EVER ANDRES NAVARRO Navas MELO Navarro Navas
EVER ANDRES NAVARRO MELO Navarro Navas
PINILLA AGUDELO JOVANNY PINIL
PINILLA AGUDELO JOVANNY PINILLA
;
data want;
set have;
flag=ifc(findw(column_a, strip(column_b), ' ', 'i'),'Y','N');
run;
Hi @Kalai2008 This is a pretty good question where FINDW in my opinion best fits the solution. You need a case insensitive search though that is taken care by 'i'
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
data have;
input Column_A $40. Column_B $20.;
cards;
CAMACHO ANAYA FAIBER ANAYA
EVER ANDRES NAVARRO Navas MELO Navarro Navas
EVER ANDRES NAVARRO MELO Navarro Navas
PINILLA AGUDELO JOVANNY PINIL
PINILLA AGUDELO JOVANNY PINILLA
;
data want;
set have;
flag=ifc(findw(column_a, strip(column_b), ' ', 'i'),'Y','N');
run;
Hi @Kalai2008 This is a pretty good question where FINDW in my opinion best fits the solution. You need a case insensitive search though that is taken care by 'i'
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content