Based on this post, I can get a list of compiled macros in a program, ordered by their first appearance, using the following code:
%macro FirstMacro();
%put Hello, World!;
%mend;
%macro SecondMacro();
%put Goodbye, cruel world!;
%mend;
proc sql;
select objname, created
from dictionary.catalogs
where objtype='MACRO' and libname ^= 'SASHELP'
order by created
;
quit;
This, however, gives all the macros in uppercase.
Object Name Date Created
--------------------------------------------------
FIRSTMACRO 09FEB17:16:12:31
SECONDMACRO 09FEB17:16:12:31
I use PascalCase for my macro names (as illustrated above). Is there a way to get a similar list, but with case sensitivity preserved?
It seems like PROC SCAPROC might provide such a list, but it's unclear to me. There is a note from when PROC SCAPROC was first released (in 9.2) that indicates that PROC SCAPROC doesn't provide support for when a %MACRO is used. However, the note says this will be a feature in future versions of SAS. With SAS 9.4 it's unclear whether the feature has been added yet.
The only other alternative I can think of is to write a script in some other language which analyzes the text above for the macro names.