SPACE: Returning a String With a Given Number of Spaces

How to:

Given an integer count, SPACE returns a string consisting of that number of spaces.

Note: To retain the spaces in HTML report output, the SHOWBLANKS parameter must be set to ON.

Syntax: How to Return a String With a Given Number of Spaces

SPACE(count)

where:

count

Numeric

Is the number of spaces to return.

Example: Returning a String With a Given Number of Spaces

The following request inserts 20 spaces between the DOLLARS and UNITS values converted to alphanumeric values. The font used is Courier because it is monospaced and shows the 20 blanks without making them proportional.

SET SHOWBLANKS = ON
TABLE FILE GGSALES
SUM DOLLARS NOPRINT  UNITS  NOPRINT AND
COMPUTE ALPHADOLL/A8 = EDIT(DOLLARS); NOPRINT
COMPUTE ALPHAUNIT/A8 = EDIT(UNITS); NOPRINT
COMPUTE Dollars_And_Units_With_Spaces/A60 = ALPHADOLL | SPACE(20) | ALPHAUNIT;
BY CATEGORY
ON TABLE SET PAGE NOLEAD
ON TABLE PCHOLD FORMAT PDF
ON TABLE SET STYLE *
GRID=OFF, FONT=COURIER,$
ENDSTYLE
END

The output is shown in the following image.