I have some errors to create the following macro, can someone help me find and solve them? %macro diag_hist(diag, code_list, num, single_code, single_code_l); data &diag; set temp; %if single_code = 1 %then %do; %if substr(code,1,&num) not in (&code_list) or code ~= &single_code_l %then delete; %end; %else %do; %if substr(code,1,&num) not in (&code_list) %then delete; %end; run; %mend; %let code_list = "Z87" "T78" "T80" "T88" "R57"; %let single_code_l = "T39.395A"; %diag_hist(anaphylaxis, &code_list, 1, 3, &single_code_l); /*The macro variables code_list and single_code_l will be used in the above macro function as parameters.*/ There must be some errors in the if-else statement. Can someone help me figure them out! Appreciating your help!
... View more