SAS EG中宏功能的自动参数和定义显示 [英] Automatic parameter and definition display for macro functions in SAS EG

查看:527
本文介绍了SAS EG中宏功能的自动参数和定义显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SAS EG中有一项简洁的功能,允许您在键入时查看宏函数的参数及其定义.

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

例如,如果我执行:

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

然后键入%test(,将弹出一个对话框,显示"a:这是a",等等.

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;

我想一种解决方法是创建一个宏%redefine_all,该宏将遍历目录并执行每个存储的宏定义,但这非常丑陋,我不确定如何处理它.

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...

推荐答案

听起来像其中一件东西".

Sounds like a 'one of those things' thing.

EG帮助关于程序编辑器"-使用自动完成功能"指出:

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:

  • 使用%LET语句或SYMPUT CALL例程定义的宏变量 使用%MACRO语句定义的
  • 宏例程 通过使用DATA步骤定义的
  • 数据集名称 声明

  • 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

    注意:程序编辑器不会自动列出宏 在当前变量之外定义的变量和例程 文档(例如,外部宏程序,%include文件和 autoexec文件).

    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).

    这篇关于SAS EG中宏功能的自动参数和定义显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆