Hi, I'm working with trade data and I want to get a substring from a numeric code that includes the code of the country of origin, destiny and type of product. But I keep getting the type mismatch error. Here's my code:

gen code1 = real(substr(code,1,3))