SAS宏保存以便快速调用的三种解决方案
2024-06-22 11:46:04阅读量:39 字体:大 中 小
1.方式一:%include
%include "full_pathsortds.txt"; inserts any code in the file called sortds.txt into your program
at the location of the %include statement. Using this method, the macro must be recompiled every
time a %INCLUDE is executed.
Advantage: This approach was presented in SAS? at least 15+ years ago; it is an easy to use and straight
forward approach.
Disadvantage: The macro definition is compiled every time the %INCLUDE is executed.
2.方式二:mautolocdisplay
Example:
filename autoM “C:SESUGTESTAUTOCALL_MACROS”;
options mautolocdisplay mautosource sasautos = (autoM) ;
The macro is saved in the folder with fileref autoM as sortDS.sas but it is not a SAS? program, it is a macro. In our
program, we call the macro using %sortDS. Once the macro is called, we can see the source of macro code in the
log .
The advantage of using the autocall facility is that all user-defined macros are stored in a standard location and they
are not compiled until they are actually needed. The macro is stored uncompiled in an autocall library. It removes the
macro definition from the calling program itself. Macros defined in separate programs must be recompiled every time
that program is execute but the macro is compiled only once and then the compiled version can be reused during the
SAS? session without recompilation.
3.方式3:STORED COMPILED MACRO FACILITY
The most exciting method of saving macros is using the store compiled macro facility. The stored compiled macro
facility compiles and saves the macro source code in a permanent catalog. This compilation occurs one time, and can
store the source code permanently in a SASMACR catalog. Programs can always be retrieved, the macro will work,
but SAS? (macro processor) will not compile the macro again. This is the great feature of the stored compiled macro
facility.
具体实现:
options mstored sasmstore=mjstore;
libname mjstore “C:SESUGTESTCompiled_macro_library”;
%macro sortDS (in=, out =, by=) / store source des="get sortDS macro“ ;
* Macro for sorting data set &in. ;
proc sort data = &in.
out = &out. ;
by &by. ;
run ;
%mend sortDS;
Advantages:
? No repeated compiling of macro programs that are repeatedly used
? Possibility of displaying the entries in a catalog containing compiled macros saving macro compile time
? There is no need to save and maintain the source for the macro definition in a different location
? Keeping track of macros is easy
? Storing more then one macro per file
? Compile and Store is faster because there is a decrease in time for searching, %including, compiling and storing
in the WORK.SASMACR catalog.
Disadvantage:
? Cannot be moved directly to other operating systems.
? Must be saved and recompiled under new OS at any new location.
将方式3的宏屏蔽的方法:
There is a way to hide code when executed so that it does not appear in the log. To avoid displaying code in the log,
store the code as a stored compiled macro. Because the macro is stored compiled, it cannot be seen in an editor.
More importantly, the options that write information about the code to the log can be turned off in the macro. The
following is a simple example:
屏蔽宏的程序实例
libname libref ’macro-storage-library-name’;
options mstored sasmstore=libref;
%macro sortDS / store;
options nonotes nomlogic nomprint nosymbolgen nosource nosource2;
...more SAS? statements...
%mend;
By storing the code as a compiled macro, virtually no information is written to the log about the code. Only warnings
and errors will be written to the log
以上就是SAS宏保存以便快速调用的三种解决方案的全部内容,望能这篇SAS宏保存以便快速调用的三种解决方案可以帮助您解决问题,能够解决大家的实际问题是谜爱阁生活网一直努力的方向和目标。
免责声明:
本文《SAS宏保存以便快速调用的三种解决方案》版权归原作者所有,内容不代表本站立场!
如本文内容影响到您的合法权益(含文章中内容、图片等),请及时联系本站,我们会及时删除处理。
推荐阅读

苹果下载记录永久删除
苹果手机的下载记录是不能删除的,但是可以设置隐藏起来不显示在已购项目中,操作方法如下: 苹果下载记录永久删除 1、打开手机的App Store,点击右上角的苹果id头像,进入账户的页面。 2、点击已...
阅读: 738

vivos12分屏模式怎么开启
vivos12手机的系统自带有分屏的功能,有需要的用户可以开启手机的分屏模式,具体的操作步骤如下: vivos12分屏模式怎么开启 1、打开手机,用手指从手机屏幕的底部向上滑动,这一过程中手指不要松开...
阅读: 784

苹果睡眠起床闹钟删不掉
苹果手机系统有一个睡眠起床闹钟的功能,这个闹钟是无法删除的,但是可以进行关闭,操作步骤如下: 苹果睡眠起床闹钟删不掉 1、打开手机的时钟app,进入下方的闹钟”界面。 2、点击起床闹钟的...
阅读: 671

怎么把小红书的视频提取出来
小红书的视频可以通过保存视频的方式提取到手机上,小红书通过保存提取视频的具体步骤如下: 怎么把小红书的视频提取出来 1、打开小红书app,然后选择需要提取的视频。 2、选择需要提取的视频后,选择右上...
阅读: 1714

抖音可以注销了重新注册吗
抖音注销了可以重新注册,抖音账号注销后,一般需要两个星期过后才可以重新注册账号。具体的操作方式如下: 抖音可以注销了重新注册吗 1、打开抖音,点击进入我”的界面。 2、进入我&rdquo...
阅读: 708

美团异地怎么点外卖给别人
美团异地可以通过修改收货地址的方法来给别人点外卖,修改收货地址给别人点外卖的具体操作步骤如下: 美团异地怎么点外卖给别人 1、打开美团app,在首页上方点击外卖进入外卖界面。 2、进入外卖界面后,点...
阅读: 710
热门文章
1.天眼查询个人信息怎么查
- 1

- 天眼查询个人信息怎么查
- 2022-12-28
- 1
2.快手登陆手机号不用了收不到验证码怎么办
- 2

- 快手登陆手机号不用了收不到验证码怎么办
- 2022-12-28
- 2
3.免费更改证件照背景色
- 3

- 免费更改证件照背景色
- 2022-12-28
- 3
4.拼多多退货商家拒收后怎么处理
- 4

- 拼多多退货商家拒收后怎么处理
- 2022-12-27
- 4
5.怎么取消淘宝省钱卡的自动续费
- 5

- 怎么取消淘宝省钱卡的自动续费
- 2022-12-27
- 5
6.微信视频号发表的朋友圈能看到吗
- 6

- 微信视频号发表的朋友圈能看到吗
- 2022-12-27
- 6
7.拼多多商家拒绝退款申请怎么办
- 7

- 拼多多商家拒绝退款申请怎么办
- 2022-12-27
- 7
8.70岁老人没有健康码怎么出行
- 8

- 70岁老人没有健康码怎么出行
- 2022-12-27
- 8
9.怎样开通支付宝花呗收款功能
- 9

- 怎样开通支付宝花呗收款功能
- 2022-12-27
- 9
10.soul引力签怎么自定义编辑
- 10

- soul引力签怎么自定义编辑
- 2022-12-27
- 10
最近更新

酷狗音乐中使用蝰蛇音效制作工具的具体操作方法
2024-11-11

win7电脑中出现声音图标不见了的具体解决方法
2024-11-11

车到哪app的详细软件介绍
2024-11-11

小米9se中查看序列号的具体操作方法
2024-11-11

迅雷中使用FTP探测器的详细操作方法
2024-11-11

ppt制作出小荷才露尖尖角动画场景的具体操作步骤
2024-11-11
