Automatic parameter and definition display for macro functions in SAS EG

家住魔仙堡 提交于 2019-12-13 03:49:56

问题


In SAS EG there is a neat feature that allows one to see the parameters of a macro function and its definitions when typing.

For example if I execute:

%macro test
(a /* this is a */
,b /* this is b */
);
%put a b;
%mend;

And then type %test(, a popup will show me "a : this is a" etc...

Unfortunately for some reason it seems to work only IF the macro function was defined in the current program (so basically in the only place where you don't really need it, as in that case it should be quite fresh in your mind).

  • Is there any way to benefit from this feature in other programs and other process flows ?

  • More importantly, how can I benefit from this feature for my stored compiled macros ?

Say for example I defined in another session :

options mstored sasmstore=mylib;
%macro test2
(c /* this is c */
,d /* this is d */
) / store source des='show c and d';
%put c d;
%mend;

I suppose a workaround would be to create a macro %redefine_all that would go through the catalog and execute every stored macro definition, but that's quite ugly and I'm not completely sure how I'd go at it...


回答1:


Sounds like a 'one of those things' thing.

The EG help "About the Program Editor" - "Using the autocomplete feature" states:

The Program Editor can also read your current program and suggest syntax for these program elements:

  • macro variables that are defined by using the %LET statement or SYMPUT CALL routine
  • macro routines that are defined by using the %MACRO statement
  • data set names that are defined by using the DATA step statement

    Note: The Program Editor does not automatically list macro variables and routines that are defined outside of the current document (for example, external macro programs, %include files, and autoexec files).



  • 来源:https://stackoverflow.com/questions/50599792/automatic-parameter-and-definition-display-for-macro-functions-in-sas-eg

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!