发布日期: 11/15/2021

Repeat

The Repeat() function makes copies of its first argument into a result. The second (and sometimes a third) argument is the number of repeats, where 1 means a single copy.

If the first argument evaluates to a character value or list, the result is that many copies.

Repeat( "abc", 2 );

"abcabc"

Repeat( {"A"}, 2 );

{"A","A"}

Repeat( {1, 2, 3}, 2 );

{1,2,3,1,2,3}

If the first argument evaluates to a number or matrix, the result is a matrix. The second argument is the number of row repeats, and a third argument can specify the number of column repeats. If only two arguments are specified, the number of column repeats is 1.

Repeat( [1 2, 3 4], 2, 3 );

[ 1 2 1 2 1 2,

3 4 3 4 3 4,

1 2 1 2 1 2,

3 4 3 4 3 4]

Repeat( 9, 2, 3 );

[ 9 9 9,

9 9 9]

The repeat function is compatible with the function of the same name in the SAS/IML language, but is incompatible with the SAS character DATA step function, which repeats one more time than this function.

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).