포스팅 목차
[MACRO] 매크로 변수 삭제하기.
macro view테이블을 사용하여서 symdel함수로 삭제하는 방법이 있어서 올립니다.
[참고]
%put 으로 매크로 변수 확인;
_ALL_, _AUTOMATIC_, _GLOBAL_, _LOCAL_, _USER_
예] %put _user_; * 사용자 정의 매크로 변수 확인;
http://support.sas.com/kb/26/154.html
Sample 26154: Delete all user-defined macro variables from the global symbol table
/* Please refer to the DETAILS tab for syntax information regarding %SYMDEL. */
%let x=1;
%let y=2;
%let z=3;
/* Write macro variable values to the log to show they do have values. */
%put &x &y &z;
/* VMACRO is a SASHELP view that contains information about currently */
/* defined macros. Create a data set from SASHELP.VMACRO to avoid a */
/* macro symbol table lock. */
%macro delvars;
data vars;
set sashelp.vmacro;
run;
data _null_;
set vars;
temp=lag(name);
if scope='GLOBAL' and substr(name,1,3) ne 'SYS' and temp ne name then
call execute('%symdel '||trim(left(name))||';');
run;
%mend;
%delvars
/* Write macro variable values to the log to show they no longer have values. */
%put &x &y &z;
* PROC SQL처리;
proc sql noprint;
select distinct NAME
into :gmacs
separated by ' '
from dictionary.macros
where upcase(SCOPE) eq 'GLOBAL' and NAME NE 'GMACS';
quit;
%symdel &gmacs gmacs;
님의
에서 발행된 글입니다.
반응형
'SAS' 카테고리의 다른 글
Enterprise Guide 4.3 : 손쉽게 따라하는 SAS가이... (0) | 2018.11.19 |
---|---|
Re:sas sql 관한 질문!! (0) | 2018.11.19 |
[관측치] 데이터 세트에서 마지막 관측치 N개 출력... (0) | 2018.11.19 |
[SAS 단축키] SAS 확장편집기 단축키 (0) | 2018.11.18 |
표준화 회귀 계수 생성하기 (0) | 2018.10.30 |
댓글