I have five different treatments for the patients in my dataset. I am trying to create a prior treatment variable that has the following response options: surgery+other treatment, immunotherapy+other treatment, radiotherapy+other treatment, chemotherapy+hormonal treatment, surgery, immunotherapy, radiotherapy, chemotherapy, hormonal treament, none of listed treatments. I would like my data to look similar to the data below: Pt # surgery immunerx radiotherapy chemotherapy hormonal priorrx 1 yes yes no yes no surgery+other treatment 2 yes no yes no no surgery+other treatment 3 yes no no no no surgery 4 no yes yes yes no immunerx+other treatment 5 no yes no no no immunerx 6 no no yes no no radiotherapy and so on... I have a variable for surgery, immunotherapy, radiotherapy, chemotherapy and hormonal therapy with response options of Yes/No. I was trying to create a do loop to cover all the different permutations and combinations. I am getting a note and errors in the log. I feel like it must be something simple, but can't figure out what I am doing wrong. In my code the else if statements are colored purple. I know that something is wrong based on that also. Please find the portion of the log below with the errors and notes: 2705 *-----------------; 2706 *calculate priorrx; 2707 *-----------------; 2708 2709 if surgery='Yes' or immunerx='Yes' or 2709! radiotherapy='Yes' or chemotherapy='Yes' or hormonal='Yes' 2709! then do; 2710 if surgery='Yes and (immunerx='Yes' or -------------------- ------------------- ------------------- --------------- ----------------- --------------------------- 49 49 49 49 49 49 --- 388 --- 76 2710! radiotherapy='Yes' or chemotherapy='Yes' or 2710! hormonal='Yes') then priorrx='surgery+other treatment'; 2711 else if surgery='Yes' and (immunerx='No' and 2711! radiotherapy='No' and chemotherapy='No' and 2711! hormonal='No') then priorrx='surgery'; ----------------- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. ERROR 388-185: Expecting an arithmetic operator. ERROR 76-322: Syntax error, statement will be ignored. 2712 2713 else if surgery='No' and immunerx='Yes' and ---------------- --------------------- ------------------- --------------- ----------------- ---------------------------- 49 49 49 49 49 49 2713! (radiotherapy='Yes' or chemotherapy='Yes' or 2713! hormonal='Yes') then priorrx='immunotherapy+other 2713! treatment'; 2714 else if immunerx='Yes' and (radiotherapy='No' and 2714! chemotherapy='No' and hormonal='No') then ------------------ 49 2714! priorrx='immunotherapy'; NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 2715 2716 else if immunerx='No' and radiotherapy='Yes' and -------------------- --------------------- --------------- ----------------- -------------------------------- 49 49 49 49 49 2716! (chemotherapy='Yes' or hormonal='Yes') then 2716! priorrx='radiotherapy+other treatment'; 2717 else if radiotherapy='Yes' and (chemotherapy='No' 2717! and hormonal='No') then priorrx='radiotherapy'; ----------------- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 2718 2719 else if radiotherapy='No' and chemotherapy='Yes' and -------------------- ---------------- ---------------- -------------------------------- 49 49 49 49 2719! hormonal='Yes' then priorrx='chemotherapy+hormonal 2719! treatment'; 2720 else if chemotherapy='Yes' and homronal='No' ---------------- 49 2720! then priorrx='chemotherapy'; NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 2721 2722 else if chemotherapy='No' and hormonal='Yes' then ---------------- ---------------- 49 49 2722! priorrx='hormonal treatment'; NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. 2723 2724 else priorrx='none of listed treatments'; 2725 2726 end; 2727 -- 49 NOTE 49-169: The meaning of an identifier after a quoted string might change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended. Any help that could be provided would be greatly appreciated. I am using SAS 9.4 TS Level 1M3. Thanks.
... View more