of the Month
When looking at a SAS program you are likely to see something like the following when dealing with text strings:
What this did was left align the text in the variable original_string and then remove any blanks after the last character.
In SAS 9 a new function was introduced called STRIP that does the same task but with one function so the original code above can instead be written as:
If you are still using an older version of SAS you could do the same thing with a macro, using the following code:
%MACRO STRIP(intxt); /*INTXT=text variable*/ TRIM(LEFT(&intxt)) %MEND STRIP; rslt_string=%STRIP(original_string);
You may wonder why there is no ';' at the end of the code inside the macro definition? This allows for the macro to be called inside the code multiple times, as the following example demonstrates:
Updated January 16, 2008