SAS로 작업 중이므로 DO 루프 내에서 일부 매크로 변수를 만들어야합니다. 이것은 내 코드의 일부입니다 : 또 다른 i=1 to &end
에서 실행 DO 루프 내부에SAS에서 && 매크로 변수를 사용하는 방법
%if &dsempty888=0 %then %do;
data _null_;
set freq_&&var&i;
if &&var&i=888888888 then do;
call symput("cont8_&&var&i",percent);
end;
run;
%end;
%if &dsempty888=1 %then %do;
%let cont8_&&var&i=0;
%end;
%if &dsempty999=0 %then %do;
data _null_;
set freq_&&var&i;
if &&var&i=999999999 then do;
call symput("cont9_&&var&i",percent);
end;
run;
%end;
%if &dsempty999=1 %then %do;
%let cont9_&&var&i=0;
%end;
%if &dsempty444=0 %then %do;
data _null_;
set freq_&&var&i;
if &&var&i=444444444 then do;
call symput("cont4_&&var&i",percent);
end;
run;
%end;
%if &dsempty444=1 %then %do;
%let cont4_&&var&i=0;
%end;
이 코드입니다. 내 매크로 변수 cont4_&&var&i
cont8_&&var&i
cont9_&&var&i
은 값 비싼 과대 평가를받으며 루프 외부에서 유용하지 않게됩니다. 나는 그들에게 예를 들어 &&cont4_&&var&i
이라고 이름을 붙이려고했다. 그러나 분명히 SAS는 매크로를 해결하지 못합니다. 실제로 루프 내부에서 매크로가 만들어 지지만 외부에 필요할 때 매크로를 호출하는 방법을 모르겠습니다.
어떻게 수정할 수 있습니까?
미리 감사드립니다.
는 또한 [이 질문] 참조 (http://stackoverflow.com/questions/24895197/resolving-multiple-ampersands-를 with-macro-variables) 및 [이 질문] (http://stackoverflow.com/questions/22903856/sas-macro-ampersand/22915555#22915555)에서 여러 앰퍼샌드 해결 방법에 대한 자세한 내용을 참조하십시오. – Joe