Hello,
I have identified regimens and want to categorize into different categories:
1) Chemo with cisplatin
2)Chemo without Cisplatin
3)Immunotherapy
4)Targeted therapy
Data want;
infile ID$ REGIMEN$
1 Cisplatin+Gemcitabine
2 Carboplatin+Cisplatin+Gemcitabine+Pembrolizumab
3 Pembrolizumab
4 Fluorouracil+Mitomycin
5 Enfortumab
ID 1 and ID 2 have cisplatin in them and should be categorized under "chemo with cisplain". ID 3 - immunotherapy; ID-4:chemo without cisplatin; ID 5 -targeted therapy.
I tried using if..then statement for example -
if find(regimen_1,'cisplatin' ,'i') then cisplatin= "yes";
if find(regimen_1,'pembrolizumab' ,'i') then immuno = "yes"
In this case ID 2 is categorized as "Chemo with cisplatin" as well as "Immuno". I just want it under "Chemo with cisplatin"
OUTPUT DESIRED
Any help would be appreciated
Instead of just IFs, use ELSE IFs:
if find(regimen_1,'cisplatin' ,'i') then cisplatin= "yes";
else if find(regimen_1,'pembrolizumab' ,'i') then immuno = "yes"
The order of statements in the ELSE IF chain will define precedence.
Instead of just IFs, use ELSE IFs:
if find(regimen_1,'cisplatin' ,'i') then cisplatin= "yes";
else if find(regimen_1,'pembrolizumab' ,'i') then immuno = "yes"
The order of statements in the ELSE IF chain will define precedence.
Hi,
Did you list REGIMEN_1 all categories in your want example? If, yes, use IF and ELSE IF statements instead of just 'IF' in your code. This should resolve the given example.
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!
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.