2

私は次のコードを試していました:

proc IML;
do i=1 to 20;  
[some codes to execute]  
data[i];  
end;  
QUIT;

したがって、do ループの完了後に 20 個のデータ セットを取得できると期待しています。SASで可能ですか?マクロを使用して実行できますが、 内でマクロを使用するのは好きではありませんPROC IML

前もって感謝します。

4

2 に答える 2

3

はい、CALL EXECUTEモジュール内でサブルーチンを使用します。

proc iml;
file LOG;

output = (1:10)`;

/*This is how you create a data set from a matrix*/
create outdata from output;
append from output;
close outdata;

/*This module will create 1 data set for each variable in OUTPUT*/
start loopit;
do i=1 to 10;
    x = output[i];
    /*build the string you want to execute*/
    outStr = 'create outdata' + catt(i) + " from x; append from x; close outdata" + catt(i) + ";";
    put outStr; /*Print the string to the log*/

    /*Execute the string*/
    call execute(outStr);
end;
finish loopit;

/*Call the module*/
call loopit;

quit;
于 2015-03-29T21:47:46.317 に答える