Pages

Saturday, August 3, 2013

Widgets

Some useful functions in SAS

SAS has a large number of useful functions; here is just a bare sampling of some of them: 

• catx( sep, a, b, c ....) –removes leading and trailing blanks 
from the character expressions a, b, c, ..., then concatenates them, 
separating them with the character expression sep. 

• compl( str )—compresses multiple blanks in the character 
expression str to single blanks. 

• scan( str, num, delims)—returns the numth word (as defined 
by delimiters in the character expression delims) of the character 
expression str. 

• substr( str, posn, len ) on the right side of an assignment 
returns the substring, starting at position posn for len characters, of the 
character expression str. 

• Here's an unusual one: substr( str, posn, len ) on the left
side of an assignment takes the character value of the right side of the 
expression and inserts it into the string str, at position posn for len
characters. 

• strip( str )—returns the contents of the character expression str
with leading and trailing blanks removed. 

No comments:

Post a Comment