I am using a scan function to count the number of drugs in a regimen; however, I need to differentiate between ' - ' and '-'. In other words, if there is not a space before and after a hyphen then I want to count that as one drug. I am also listing some drugs that do not get counted. For example, I want initialChemoCount =0 for sipuleucel-t and ziv-afilbercept and initialChemoCount = 2 for 'fluorouracil - oxaliplatin'. I also want to make sure drug names with spaces is counted as 1 drug (e.g. string1 = 'paclitaxel albumin bound' ). The code below is close but not working because the scan reads 'sipuleucel-t' as two separate drugs and 'fluorouracil - irinotecan - ziv-aflibercept' as 3 when it should be 2 based on exclusions. Any suggestions? data test ; *string1 = 'sipuleucel-t' ; /*initialchemocount = 0 because I want to exclude them in the count*/ *string1 = 'ziv-afilbercept' ; /*initialchemocount = 0 because I want to exclude them in the count*/ *string1 = 'paclitaxel albumin bound' ; /*initialchemocount = 1*/ *string1 = 'fluorouracil - oxaliplatin' ; /*initialchemocount = 2*/ string1 = 'fluorouracil - irinotecan - ziv-aflibercept' /*initialchemocount = 2 because I want to exclude ziv-aflibercept*/ /*Count the number of drugs in original drug combo*/ ComboCount = count(string1," - " ) + 1; /*Count the number of chemo drugs in original drug combo*/ array initchemo{20} $200 ; initialChemoCount = comboCount ; do j = 1 to combocount until (p <= 0) ; call scan(string1,j,p,l," - ") ; if p=1 then initchemo[j] = substrn(string1, p, l-1); /*use p and l to account for legitimate space e.g. paclitaxel albumin bound */ else initchemo[j] = substrn(string1,p+1,l-1) ; if index(initchemo[j],'investigational' ) then initialchemocount=. ; else if initchemo[j] IN ('sipuleucel-t', 'ziv-afilbercept', 'abiraterone', 'enzalutamide', 'interferon alfa-2b', 'radium Ra 223 dichloride' ) then initialchemocount=0 ; else if prxmatch("m/sipuleucel-t|ziv-afilbercept|ado-trastuzumab|interferon|mab|abiraterone|enzalutamide|radium Ra 223 dichloride/oi",initchemo[j]) > 0 then initialChemoCount = initialchemocount - 1 ; end ; run; PROC PRINT DATA=test ; VAR string1 initialchemocount combocount chemodrugcount initchemo:; run;
... View more