简体   繁体   English

SAS选项值到宏变量

[英]SAS option value to macro variable

I want to store the value of a SAS option in a macro variable so I can reset the option, not to the default value but to what it was before, like this: 我想将SAS选项的值存储在宏变量中,以便可以将选项重置为默认值,而不是重置为默认值,如下所示:

options mprint &prev.; 选项mprint&prev .;

Does anyone know how to store the current option value in a macro variable? 有谁知道如何将当前选项值存储在宏变量中?

Like this: 像这样:

%let oldValue = %sysfunc(getoption(linesize));

You can look up the details of the SYSFUNC and GETOPTION functions in SAS's online documentation here: https://support.sas.com/en/documentation.html 您可以在以下位置的SAS在线文档中查找SYSFUNC和GETOPTION函数的详细信息: https : //support.sas.com/en/documentation.html

It's worth spending ten minutes a day just browsing the docs, you will learn a lot. 每天花十分钟浏览文档是值得的,您会学到很多。

If you are changing more than a few options, or don't want to deal options on an individual level, consider using PROC OPTSAVE and PROC OPTLOAD . 如果您要更改多个选项,或者不想单独处理多个选项,请考虑使用PROC OPTSAVEPROC OPTLOAD This form of options management is especially useful if you are working with a variety of macros and macro based frameworks within a single session. 如果您在单个会话中使用各种宏和基于宏的框架,则这种形式的选项管理特别有用。

libname options 'C:\Temp\MyOptions';

proc optsave out=options.held;

  options ls=max ps=max nocenter nodate nonumber orientation=landscape;
  %RichardForecastReport(date='01MAR2019')

proc optload data=options.held;

  options ls=128 ps=100 center date number orientation=portrait;
  %HenrikForecastCharts(date='01MAR2019')

proc optload data=options.held;
   … todays adhoc … 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM