BookmarkSubscribeRSS Feed

[SAS 활용 FAQ] Find current directory path

Started ‎11-17-2021 by
Modified ‎11-17-2021 by
Views 692

현재 디렉토리 경로 찾기

 

기본 출력에 사용할 디렉토리를 파악하기 위해 작동하는 일부 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;

Contributors
Version history
Last update:
‎11-17-2021 10:03 PM
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

Article Labels
Article Tags