1.方式一:%include

%include "full_path\sortds.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:\SESUGTEST\AUTOCALL_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:\SESUGTEST\Compiled_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宏保存以便快速调用的三种解决方案(转载)相关推荐

  1. 分布式事务中常见的三种解决方案

    分布式事务中常见的三种解决方案 目录 一.分布式事务前奏 二.柔性事务解决方案架构 (一).基于可靠消息的最终一致性方案概述 (二).TCC事务补偿型方案 (三).最大努力通知型 三.基于可靠消息的最 ...

  2. 跨域的这三种解决方案你知道吗?

    文章目录 什么是跨域? 跨域的三种解决方案 - JSONP 1. 使用原生 js 来书写 JSONP解决跨域问题 2. jQuery 中使用JSONP来解决跨域 - CORS - 搭建代理服务器 什么 ...

  3. 计算机不识别lacie硬盘,windows10系统下移动硬盘读不出来的三种解决方案

    移动硬盘即是便携性的存储产品,其具有超大的空间,我们可以将资料很好地保存进去.不过,一些windows10系统用户发现将移动硬盘的USB插上计算机后,会遇到"无法识别USB设备"的 ...

  4. ROS学习:cv_bridge与opencv版本冲突三种解决方案

    cv_bridge与opencv版本冲突三种解决方案 1 问题描述: 2 解决方案: 2.1 不使用cv_bridge包 2.2 令cv_bridge使用opencv版本切换为自己工程所使用的版本 2 ...

  5. win10微软图标点击无反应_Win10下鼠标双击桌面图标打不开应用的三种解决方案...

    电脑安装的是最新的windows10正式版系统,不过最近在使用过程中出现了一个问题,即鼠标双击桌面图标没有反应,打不开应用程序,这是怎么回事呢?下面,系统城小编就为大家介绍Windows10系统鼠标双 ...

  6. 跨域请求的三种解决方案

    跨域的三种解决方案 一.同源策略 二.jsonp 三.cors 四.proxy 一.同源策略 xhr对象无法跨域请求文件.通俗讲就是"浏览器"给js发送请求的限制,你只能给自己域名 ...

  7. 实战 2000w 数据大表的优化过程,提供三种解决方案

    大家好,我是不才陈某~ 当我们业务数据库表中的数据越来越多,如果你也和我遇到了以下类似场景,那让我们一起来解决这个问题 数据的插入,查询时长较长 后续业务需求的扩展 在表中新增字段 影响较大 表中的数 ...

  8. thinkpad卡在logo界面_由于win7系统启动卡在Thinkpad LOGO屏幕上而导致无法进入系统的三种解决方案...

    最近联想平板卡在主界面,一个Win7 pure版本系统的用户报告说,在打开计算机电源时,发现它卡在了Thinkpad引导LOGO屏幕上,并且无法正常进入系统桌面. win7系统卡在徽标界面上的原因有很 ...

  9. python函数拟合不规则曲线_python 对任意数据和曲线进行拟合并求出函数表达式的三种解决方案...

    第一种是进行多项式拟合,数学上可以证明,任意函数都可以表示为多项式形式.具体示例如下. ###拟合年龄 import numpy as np import matplotlib.pyplot as p ...

最新文章

  1. 引导修复_怎么使用bcdrepair引导修复系统【详细步骤】
  2. 拒绝接口裸奔!开放API接口签名验证!
  3. Synchronize对象改变
  4. WannaCry勒索比特币蠕虫病毒解决方案
  5. spring boot报错Invalid numeric value: Leading zeroes not allowed
  6. go中有缓存通道和无缓存通道区别
  7. Android在线更新安装包,Android在线更新下载方案
  8. 【报告分享】2019-2020年人工智能产业人才发展报告.pdf(附下载链接)
  9. 一次Linux服务器***查杀经历
  10. python中os关于目录创建和文件移动操作
  11. 邱锡鹏nndl学习记录
  12. 一元非线性方程求根的算法——二分法/牛顿迭代法
  13. 新手自己搭建、开发网络直播平台历程——了解实现一个简单直播平台的结构
  14. “电子警察”拆除竞赛
  15. 获取用户已安装的APP列表及APK安装包
  16. PV,V,UV的概念,采集数据
  17. 难上加难?女性在技术领域可以这样做……
  18. server2012搭建ftp服务器
  19. python积累--读写文本文件实例
  20. html查看器wifi,wifi密码查看器电脑版

热门文章

  1. php bin2hex(),PHP bin2hex() 函数 pack() 函数
  2. 【渝粤教育】电大中专电商运营实操 (18)作业 题库
  3. 【渝粤教育】电大中专建筑施工组织作业 题库
  4. 【渝粤教育】电大中专消费者行为学 (3)作业 题库
  5. [渝粤教育] 西南科技大学 经济法概论 在线考试复习资料2021版(3)
  6. 【渝粤教育】电大中专就业指导作业 题库
  7. 1835财务报表分析
  8. 亿佰特物联网无线模块通信技术分析
  9. matlab 形态学 颗粒_数字图像处理Matlab-形态学图像处理(附代码)
  10. 常用计算机网络性能指标的是什么,什么是Bit?【计算机网络的性能指标】