data aaa;
input x y;
cards;
1 2
3 4
;
run;
%macro aaa;
data _null_;
set aaa;
do i=1 to 2;
if _N_ =i then do;
call symput('Value',x);
call symput('TagValue',y);
%put &value;
%put &tagvalue;
end;
end;
run;
%mend;
%aaa;
ผลลัพธ์คือ 3 4 ไม่ใช่ 1 2 3 4 จะวนซ้ำเพื่อดึงค่าจากชุดข้อมูลได้อย่างไร ขอบคุณ!
&Value
ควรเป็น1 3
และ&TagValue
เป็น2 4
หรือไม่ คุณคาดหวังว่า&Value
และ&TagValue
จะเป็นอาร์เรย์ (ซึ่งเป็นไปไม่ได้ แต่คุณสามารถสร้าง&Value1
,&Value2
&TagValue1
และ&TagValue2
แล้วเขียน%do suffix = 1 %to 2; blabla; %end;
ได้) บางทีคุณควรอธิบายเราว่าคุณต้องการทำอะไรกับพวกเขาในภายหลัง - person Dirk Horsten   schedule 18.01.2015