A to Z of Data Step Functions
This section contains examples of exploiting using SAS data step functions (many of which also apply to Proc SQL) as created by our SAS Consultancy team. The contents will grow regularly through time.
We send out a regular newsletter communication to our customers which include our latest SAS tips. Sign up to the Amadeus Newsletter.
-
Finding a Words Start Position
- Date:
- October 2011
The SCAN function provides a flexible way of finding the nth word in a character string, by allowing searches to be conducted in either direction along the string and through ...
-
Reading Backwards!
- Date:
- October 2011
The SUBSTR function provides an easy way of extracting a sub-string from a longer string by specifying the character position to begin extracting from and a number of characte...
-
Incrementing Character Values
- Date:
- July 2011
Incrementing numeric values can be easily achieved using SAS software, but what about incrementing character values?
-
Getting the Most out of the INTNX Function
- Date:
- April 2011
The INTNX function is a SAS date time function that returns a SAS date value by adding a specific number of increments to an initial start date for example, add one week to to...
-
Time Shifting
- Date:
- December 2010
INTNX is a very useful SAS date function which returns a SAS date corresponding to a point within a time interval either in the past or the future.
-
Returning the Right Length
- Date:
- September 2010
A well known function in SAS is the LENGTH function – used to return the length of a character string.
-
LARGEST and SMALLEST Functions
- Date:
- May 2010
The MAX and MIN functions allow you to easily identify the maximum and minimum values from a selection of variables. However in order to find the second highest value or the b...
-
The Enhanced COMPRESS Function
- Date:
- March 2010
The COMPRESS function has been enhanced in SAS 9 by providing an optional 3rd argument, which controls the functions behaviour.
-
Useful String Functions: strip, scanq, substrn
- Date:
- March 2010
Explanation of the string functions strip, scanq and substrn
-
The COMPBL Function for Compressing Embedded Blanks
- Date:
- February 2010
The COMPBL function will remove all leading and trailing blanks but will retain single embedded blanks, which is useful for name fields.


