REPEAT Function

Returns a character value that consists of the first argument repeated n+1 times.

Category: Character
Restriction: I18N Level 2 functions are designed for use with SBCS, DBCS, and MBCS (UTF8).

Syntax

REPEAT(argument,n)

Required Arguments

argument

specifies a character constant, variable, or expression.

n

specifies the number of times to repeat argument.

Restriction n must be greater than or equal to 0.

Details

In a DATA step, if the REPEAT function returns a value to a variable that has not previously been assigned a length, then that variable is given a length of 200 bytes.
The REPEAT function returns a character value consisting of the first argument repeated n times. Thus, the first argument appears n+1 times in the result.

Example

The following SAS statements produce these results.
SAS Statement
Result
x=repeat('ONE',2);
put x;
 
ONEONEONE