I've worked out how to remove the dashes, using the following syntax:
string newdiag (A6).
compute newdiag = RTRIM(diag3, '-').
But when I tried to do the same for the Xs (sometimes a code has X- on the end, so I need to remove the dashes first then the Xs), using the same syntax (see below) it gave no error messages but didn't remove the Xs.
string newerdiag (A6).
compute newerdiag = RTRIM(newdiag, 'X').
Can anyone see what I'm doing wrong in the second bit of code?