Strip out unwanted characters from string variables - ---------------------------------------------------
^strip^ var, ^of("^character string^")^ ^g^enerate^(^newvar^)^
^strip^ removes unwanted characters (usually punctuation marks) from string variables, and saves the transformed string as a new variable. Uses include: converting numbers formatted with commas to ordnary strings, standardising codes that sometimes include spaces. Tidying up various types of messy data entry.
Options - ------- ^of^ specifies the characters to be removed. One or more characters are allowed.
^generate^ gives the name of the new variable to be created. Newvar will be a string variable; you do not need to specify this.fs
Examples - --------
. ^strip cost, of("$,") gen(temp)^ . ^gen cost2 = real(temp)^ . ^drop temp^
. ^strip outcome, of("eso") gen(out)^
Also see - --------
Manual: [R] @functions@.