引数の値をランダムに置換します。
| カテゴリ: | 組み合わせ |
乱数シードが含まれる数値変数です。シードの詳細については、 シード値を参照してください。
同じ長さのすべての数値変数またはすべての文字変数を指定します。これらの変数の値がランダムに置換されます。
data _null_;
array x x1-x4 (1 2 3 4);
seed=1234567890123;
do n=1 to 10;
call ranperm(seed, of x1-x4);
put seed=@20 ' x= ' x1-x4;
end;
run;seed=1332351321 x= 1 3 2 4 seed=829042065 x= 3 4 2 1 seed=767738639 x= 4 2 3 1 seed=1280236105 x= 1 2 4 3 seed=670350431 x= 2 1 4 3 seed=1956939964 x= 2 4 3 1 seed=353939815 x= 4 1 2 3 seed=1996660805 x= 4 3 1 2 seed=1835940555 x= 4 3 2 1 seed=910897519 x= 3 2 1 4
%macro test;
%let x1=ant;
%let x2=-.1234;
%let x3=1e10;
%let x4=hippopotamus;
%let x5=zebra;
%let seed=12345;
%do j=1 %to 10;
%syscall ranperm(seed, x1, x2, x3, x4, x5);
%put j=&j &x1 &x2 &x3;
%end;
%mend;
%test;j=1 zebra ant hippopotamus j=2 10000000000 ant -0.1234 j=3 -0.1234 10000000000 ant j=4 hippopotamus ant zebra j=5 -0.1234 zebra 10000000000 j=6 -0.1234 hippopotamus ant j=7 zebra ant -0.1234 j=8 -0.1234 hippopotamus ant j=9 ant -0.1234 hippopotamus j=10 -0.1234 zebra 10000000000