# Смартсорсинг.ру

Сообщество руководителей ИТ-компаний, ИТ-подразделений и сервисных центров

# SAS-Functions

SAS has a large variety of in-built functions, it helps in analyzing the processing the data. These parties are used as part of the DAT reports. They take data variables as evidence and reflect the result. It is stored in another variable. The type of function, the number of arguments it takes can vary.

Some functions accept as zero evidence, while the other accepts as a fixed number of variables. The list of types of functions SAS provides.

Learn SAS Training in Chennai ? Walk into FITA, FITA is one of the best leading institutions for SAS Course in Chennai

# Function Categories

Depending on their usage, the functions in SAS are categorized as below:

• Mathematical
• Date and Time
• Character
• Truncation
• Miscellaneous

## Mathematical Functions

These are the functions applied to use some scientific thoughts on the shifting values.

## Examples

The following SAS application teaches the application of any relevant mathematical functions.

v1=21; v2=42; v3=13; v4=10; v5=29;

/* Get Maximum value */

max_val = MAX(v1,v2,v3,v4,v5);

/* Get Minimum value */

min_val = MIN (v1,v2,v3,v4,v5);

/* Get Median value */

med_val = MEDIAN (v1,v2,v3,v4,v5);

* Get a random number */

rand_val = RANUNI(0);

/* Get Square root of sum of the values */

SR_val= SQRT(sum(v1,v2,v3,v4,v5));

proc print data = Math_functions noobs;

run;

## Date and Time Functions

These are the functions used to process data and time values.

### Examples

The below SAS program convinces the value of date and time functions.

data date_functions;

INPUT @1 date1 date9. @11 date2 date9.;

format date1 date9.  date2 date9.;

/* Get the interval between the dates in years*/

Years_ = INTCK('YEAR',date1,date2);

/* Get the interval between the dates in months*/

months_ = INTCK('MONTH',date1,date2);

/* Get the week day from the date*/

weekday_ =  WEEKDAY(date1);

/* Get Today's date in SAS date format */

today_ = TODAY();

/* Get current time in SAS time format */

time_ = time();

DATALINES;

21OCT2000 16AUG1998

01MAR2009 11JUL2012

;

proc print data = date_functions noobs;

run;

## Truncation Functions

These are the functions used to trim numeric values.

### Examples

The below SAS program shows the use of truncation functions

data trunc_functions;

/* Nearest greatest integer */

ceil_ = CEIL(11.85);

/* Nearest greatest integer */

floor_ = FLOOR(11.85);

/* Integer portion of a number */

int_ = INT(32.41);

/* Round off to nearest value */

round_ = ROUND(5621.78);

run;

proc print data = trunc_functions noobs;

run;

Learn  SAS Training Institute in Chennai , at FITA and gain more knowledge in the SAS field.