DOPEN関数によって開かれたディレクトリを閉じます。
カテゴリ: | 外部ファイル |
%macro memnum(filrf, path);
%let rc=%sysfunc(filename(filrf, &path));
%if %sysfunc(fileref(&filrf))=0 %then
%do;
/* Open the directory. */
%let did=%sysfunc(dopen(&filrf));
%put did=&did;
/* Get the member count. */
%let memcount=%sysfunc(dnum(&did));
%put &memcount members in &filrf.;
/* Close the directory. */
%let rc=%sysfunc(dclose(&did));
%end;
%else %put Invalid FILEREF;
%mend;
%memnum(MYDIR, physical-filename)
%let filrf=MYDIR;
data _null_;
rc=filename("&filrf", "physical-filename");
if fileref("&filrf")=0 then
do;
/* Open the directory. */
did=dopen("&filrf");
/* Get the member count. */
memcount=dnum(did);
put memcount "members in &filrf";
/* Close the directory. */
rc=dclose(did);
end;
else put "Invalid FILEREF";
run;