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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.