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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.