| Functions and CALL Routines |
| Category: | Random Number |
| Syntax | |
| Arguments | |
| Examples | |
| See Also |
Syntax |
| CALL RANPERK(seed, k, variable-1<, variable-2, ...>); |
is a numeric variable that contains the random number seed. For more information about seeds, see Seed Values.
is the number of values that you want to have in the random permutation.
specifies all numeric variables, or all character variables that have the same length. K values of these variables are randomly permuted.
| Examples |
The following example shows how to generate random permutations of given values by using the CALL RANPERK routine.
data _null_;
array x x1-x5 (1 2 3 4 5);
seed = 1234567890123;
do n=1 to 10;
call ranperk(seed, 3, of x1-x5);
put seed= @20 ' x= ' x1-x3;
end;
run;
The following lines are written to the SAS log:
seed=1332351321 x= 5 4 2 seed=829042065 x= 4 1 3 seed=767738639 x= 5 1 2 seed=1280236105 x= 3 2 5 seed=670350431 x= 4 3 5 seed=1956939964 x= 3 1 2 seed=353939815 x= 4 2 1 seed=1996660805 x= 3 4 5 seed=1835940555 x= 5 1 4 seed=910897519 x= 5 1 2
| See Also |
|
Functions: |
Copyright © 2007 by SAS Institute Inc., Cary, NC, USA. All rights reserved.