Describe any three SAS functions
- LENGTH: The length of an argument is returned without counting the trailing blanks.
Ex:
animal=’my cat’;
len=LENGTH(animal);
Result is - 6
- SUBSTR: The SUBSTR function extracts a substring from a given argument starting at a given ‘position’ for ‘n’ characters or until the end if ‘n’ is not specified
Ex:
data dsn;
value =’(916)734-6241’;
substring=SUBSTR(value,2,3);
Result is - 916
-
TRIM: It removes the trailing blanks from a given character expression
Ex:
Str1 = ‘my’;
Str2 = ‘cat’;
Result = TRIM(Str1)(Str2);
Result = ‘mycat’