I have data that looks like -
| row | episode | detail | date1 | date2 | detail2 |
| 1 | 1 | BIGUANIDES | 13-Feb-13 | 19-Jul-13 | BIGUANIDES |
| 2 | 4 | BIGUANIDES | 6-Sep-16 | 12-Oct-16 | BIGUANIDES |
| 3 | 3 | BIGUANIDES | 19-Oct-15 | 21-Jun-16 | BIGUANIDES |
| 4 | 2 | BIGUANIDES | 19-Nov-13 | 18-Dec-13 | BIGUANIDES |
| 5 | 1 | BIGUANIDES+DPP-4 | 19-Nov-13 | 18-Dec-13 | DPP-4 + BIGUANIDES |
| 6 | 5 | DPP-4+BIGUANIDES | 6-Sep-16 | 12-Oct-16 | DPP-4 + BIGUANIDES |
| 7 | 4 | BIGUANIDES | 19-Oct-15 | 21-Jun-16 | DPP-4 + BIGUANIDES |
| 8 | 3 | DPP-4 | 6-May-14 | 9-Oct-14 | DPP-4 + BIGUANIDES |
| 9 | 2 | DPP-4 | 5-Apr-14 | 4-May-14 | DPP-4 + BIGUANIDES |
I only want to keep rows where the column names: detail and detail2 are same
however do i identify cases like line5?
Like this?
data temp;
attrib detail1 length=$30;
attrib detail2 length=$30;
attrib d11 length=$30;
attrib d12 length=$30;
attrib d21 length=$30;
attrib d22 length=$30;
attrib flag length=3;
detail1 = "BIGUANIDES+DPP-4";
detail2 = "DPP-4 + BIGUANIDES";
d11 = scan(compress(detail1, ' '), 1, '+');
d12 = scan(compress(detail1, ' '), 2, '+');
d21 = scan(compress(detail2, ' '), 1, '+');
d22 = scan(compress(detail2, ' '), 2, '+');
if (d11 eq d21 or d11 eq d22)
and (d12 eq d21 or d12 eq d22)
then flag = 1;
else flag = 0;
run;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.