현재 디렉토리 경로 찾기
기본 출력에 사용할 디렉토리를 파악하기 위해 작동하는 일부 SAS 코드를 살펴보다, Tom Hoffman 께서 20 년 전에 도와주신 만든 매크로가 생각났습니다. 해당 코드를 github에 버전을 게시했습니다. curdir.sas
아이디어는 간단합니다. 현재 작업 디렉토리를 가리키는 파일 참조를 생성한 뒤 SAS에서 파일 참조가 가리키는 경로를 묻습니다. 그러면 해당 경로가 매크로의 내용으로 반환됩니다. 이러한 작업을 통해 매크로 호출을 다른 SAS 명령문에 포함 할 수 있습니다.
%macro curdir; /*---------------------------------------------------------------------- Returns the current SAS directory physical name. ----------------------------------------------------------------------*/ /*---------------------------------------------------------------------- Originally developed by Tom Hoffman. Posted in memory of Tom and Fan. ----------------------------------------------------------------------- Usage:
%put %curdir is the current directory.; ------------------------------------------------------------------------ Notes:
----------------------------------------------------------------------- History:
11MAR99 TRHoffman Creation - with help from Tom Abernathy. 06DEC00 TRHoffman Used . notation to refernece current directory as suggested by Fan Zhou. ----------------------------------------------------------------------*/ %local fr rc curdir;
%let rc = %sysfunc(filename(fr,.)); %let curdir = %sysfunc(pathname(&fr)); %let rc = %sysfunc(filename(fr));
&curdir
%mend curdir; |
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.