09-01-2014 02:47 AM
I need to remove [" from the word say ["Mumbai"]. I am able to remove the [ and ] using functions like Tranwrd however I want to know how to remove the " as the function syntax itself has an opening " and a closing " and I am unable to remove the " (which is itself a part of the input). SAS does not seem to be accepting the " within the opening " and closing ". I will appreciate any help.
09-01-2014 03:09 AM
When you need to remove characters, I would use the character functions not the word ones. eg SAS(R) 9.4 Functions and CALL Routines: Reference, Third Edition PRX (perl regular strings) are also an option. Within SAS the definition of a string is a basic concept but lost a clear reference. Single quotes (no macro expansion) double quotes (with macro expansion can be used to mark a string begin/end . Repeating a quote is masking the meaning. See: SAS(R) 9.4 Language Reference: Concepts, Third Edition example on Tom's
09-01-2014 07:47 AM
you can use compress with the "keep" option to select all letters from the original text,
because you have capital letters as well I recommend the following syntax :
need=compress(have,'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'K');
any_other_word='["or any other word"]';
any_other_word1=compress(any_other_word,'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'K');
this way you can deal with capital letters and blanks you want to keep, and get rid of all other punctuations symbols .
09-01-2014 08:05 AM
If you want to include a quote inside of a quoted string you need to double up the quote character. Note that you can also convert from using using double quotes to single quotes.
" ""Mumbai"" "
' "Mumbai" '