简体   繁体   中英

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:

options 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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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