MONTHNAME: Returning the Name of the Month From a Date Expression

How to:

MONTHNAME returns a character string that contains the data-source-specific name of the month for the month part of a date expression.

Syntax: How to Return the Name of the Month From a Date Expression

MONTHNAME(date_exp)

where:

date_exp

Is a date or date-time expression.

Example: Returning the Name of the Month From a Date Expression

The following request returns the name of the month from the TRANSDATE field.

TABLE FILE EMPLOYEE
PRINT HIRE_DATE
COMPUTE TRANSDATE/YYMD= HIRE_DATE; NOPRINT
COMPUTE MONTHNAME1/A12 = MONTHNAME(TRANSDATE);
BY  TRANSDATE
ON TABLE SET PAGE NOLEAD
ON TABLE SET STYLE *
GRID=OFF,$
ENDSTYLE
END

The output is shown in the following image.