
USING SAS FUNCTIONS TO MANIPULATE YOUR DATAWhen planning modifications to SAS data sets, be sure to examine the many SAS functions that are available. SAS functions are prewritten expressions that provide programming shortcuts for many calculations and manipulations of data. SAS functions can be used in DATA step programming statements, PROC SQL and in some statistical procedures. A SAS function can be specified anywhere that you would use a SAS expression, as long as the function is part of a SAS statement. SAS functions also ignore missing values.How can I use a SAS function to create the average of three variables? The assignment statement below uses the MEAN function to calculate the average of three exam scores that are stored in the variables Exam1, Exam2, and Exam3. The function calculates the mean of the three variables that are listed as arguments.
How can I convert my data from character to numeric and visa versa using SAS functions? To convert CHARACTER values to NUMERIC values you use the INPUT function and to convert NUMERIC values to CHARACTER values you use the PUT function. The form of the INPUT and PUT functions is as follows:
However, note that the INPUT function requires an informat, whereas the PUT function requires a format. To remember which function requires a format versus an informat, note that the INPUT function requires the informat. The following SAS code converts a numeric date value to a SAS date value stored as the number of days from 1st January 1960 using the INPUT and PUT functions.
Some other useful SAS functions:

