t*********l 发帖数: 778 | 1 proc iml;
x = j(100,100,0);
do i = 1 to 100;
do j=1 to 100;
x[i,j] = n_&i._&j;
end;
end;
quit;
为什么这个不work呢? | s****e 发帖数: 1180 | 2 I am wondering why you put "&" before i, j in x[i,j] = n_&i._&j. If it is
for macro, then you need to put "%" before "do" both for "i" loop and "j"
loop.
Good Luck!
【在 t*********l 的大作中提到】 : proc iml; : x = j(100,100,0); : do i = 1 to 100; : do j=1 to 100; : x[i,j] = n_&i._&j; : end; : end; : quit; : 为什么这个不work呢?
| t*********l 发帖数: 778 | 3 STILL NOT WOKRING!! n_i_j is macro variables i=1-3 j=1-3
proc iml;
x = j(3,3,0);
%macro call;
%do i = 1 %to 3;
%do j=1 %to 3;
x[i,j] = &&n_&i._&j;
%end;
%end;
%mend;
%call;
quit; | s****e 发帖数: 1180 | 4 I think proc iml should be inside %macro call, like the following:
%macro call;
proc iml;
x = j(3,3,0);
%do i = 1 %to 3;
%do j=1 %to 3;
x[i,j] = &&n_&i._&j;
%end;
%end;
quit;
%mend;
%call;
I once did it. Good Luck!
【在 t*********l 的大作中提到】 : STILL NOT WOKRING!! n_i_j is macro variables i=1-3 j=1-3 : proc iml; : x = j(3,3,0); : %macro call; : %do i = 1 %to 3; : %do j=1 %to 3; : x[i,j] = &&n_&i._&j; : %end; : %end; : %mend;
| s****e 发帖数: 1180 | 5 Maybe, I did not understand you. Anyway. Good Luck!
【在 s****e 的大作中提到】 : I think proc iml should be inside %macro call, like the following: : %macro call; : proc iml; : x = j(3,3,0); : %do i = 1 %to 3; : %do j=1 %to 3; : x[i,j] = &&n_&i._&j; : %end; : %end; : quit;
| s****e 发帖数: 1180 | 6 I think that as macro variables, at least, it should be x[&i,&j] = &&n_&i._&
j. Good Luck!
【在 t*********l 的大作中提到】 : STILL NOT WOKRING!! n_i_j is macro variables i=1-3 j=1-3 : proc iml; : x = j(3,3,0); : %macro call; : %do i = 1 %to 3; : %do j=1 %to 3; : x[i,j] = &&n_&i._&j; : %end; : %end; : %mend;
|
|