Monday, March 10, 2008

TRANWRD, COMPRESS & INDEXW

-
TRANWRD Function: "Replace all ocurrences of a word".
name=tranwrd(name, "Miss", "Ms.");
put name;

Value: Miss. Joan Smith
Result: Ms. Joan Smith

More:
http://www.asu.edu/sas/sasdoc/sashtml/lgref/z0215027.htm

COMPRESS Function: "Removes specific characters from a character string".
a='AB C D ';
b=compress(a);
put b;

Value: 'AB C D ';
Result: ABCD

More:
http://support.sas.com/onlinedoc/913/getDoc/en/lrdict.hlp/a000212246.htm

INDEXW Function: "Returns the first position in the character-value that contains the find-string". If the find-string is not found, the function returns a 0.
indexw(STRING1,"the");

Value: STRING1 = "there is a the here"
Result: 12 (the word "the")

More:
http://support.sas.com/publishing/pubcat/chaps/59343.pdf
-

No comments:

Post a Comment