Hi I have a column of codes containing alphanumeric characters: Code 1A2B3C4D 2B3C3D 1A1G2C2B3A and so on.... I need to split the code into 2-character variables thus: Code Type_a Type_b Type_c Type_d 1A2B3C4D 1A 2B 3C 4D 2B3C3D 2B 3C 3D This is the code I am using: data f12; set f12; type_a=substr(code,1,2); type_b=substr(code,3,2); type_c=substr(code,5,2); type_d=substr(code,7,2); type_e=substr(code,9,2); run; The code runs but returns this error: NOTE: Invalid second argument to function SUBSTR at line 2007 column 8. Each time, I run the code, the error pertains to a different line/row. I thought I could use substrn to avoid the problem but I was testing the difference in output with both substr and substrn but the results come off the same. Should I use the Strip or Trim function as in: type_a=substr(trim(code),1,2)? Thanks!
... View more