-
Notifications
You must be signed in to change notification settings - Fork 2
/
_liblist.sas
67 lines (43 loc) · 1.7 KB
/
_liblist.sas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
%put NOTE: You have called the macro _LIBLIST, 2015-10-21.;
%put NOTE: Copyright (c) 2015 Rodney Sparapani;
%put;
/*
Author: Rodney Sparapani <[email protected]>
Created: 2015-08-11
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file; see the file COPYING. If not, write to
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
%macro _liblist(libname=REQUIRED, lib=&libname, log=);
%global _liblist;
%_require(&lib);
%if %length(&log) %then %_printto(log=&log);
%local dir files i;
%let dir=%sysfunc(pathname(&lib));
%_fileref(fileref=_liblist, file=%_dir(&dir)*.%scan(%_suffix(), 1, %str( )), out=files);
%let files=%_level(data=files, var=file, split=:);
/*
%let _liblist=%_level(data=files, var=file, split=:);
%_fileref(fileref=_liblist, file=%_dir(&dir)*.%scan(%_suffix(), 3, %str( )), out=files);
%let files=&_liblist%_level(data=files, var=file, split=:);
*/
%let _liblist=;
%do i=1 %to %_count(&files, split=:);
%let _liblist=&_liblist &lib..%_lib(%_tail(%scan(&files, &i, :), split=%_dirchar()));
%end;
%if %length(&log) %then %_printto;
%mend _liblist;
%*VALIDATION TEST STREAM;
/* un-comment to re-validate
libname phi '/data/phi/rsparapa/sas/libname/phi';
%_liblist(lib=phi);
%put &_liblist;
*/