BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi Everyone,
Is there a way to get the value of an option into a dataset.\ ?

for example if i run the below statement it prints the value of option to the log.

but is there a way to get this value in a dataset so that i can check if mprint option is set to Mprint or nomprint?

proc options option=mprint;
run;
1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Macro variables are more common:

 

/* Save the value of the MPRINT system option */
%let mprint_option = %sysfunc(getoption(MPRINT));

@NN wrote:

Hi Everyone,
Is there a way to get the value of an option into a dataset.\ ?

for example if i run the below statement it prints the value of option to the log.

but is there a way to get this value in a dataset so that i can check if mprint option is set to Mprint or nomprint?

proc options option=mprint;
run;

 

View solution in original post

4 REPLIES 4
ballardw
Super User

You can use the DMOPTSAVE command with a data set to save the current settings of all options to a data set such as Work.myopts in the Display Manager. Not sure about other interfaces like Enterprise Guide or SAS Studio.

How you issue the command depends on your system.

You could then search for the name of the option, Optname and Optvalue. The on/off type options like MPRINT have values of "0" (off) or "1" (on). The option values are character because many of the system options like FMTSEARCH can have character values.

Reeza
Super User

Macro variables are more common:

 

/* Save the value of the MPRINT system option */
%let mprint_option = %sysfunc(getoption(MPRINT));

@NN wrote:

Hi Everyone,
Is there a way to get the value of an option into a dataset.\ ?

for example if i run the below statement it prints the value of option to the log.

but is there a way to get this value in a dataset so that i can check if mprint option is set to Mprint or nomprint?

proc options option=mprint;
run;

 

NN
Quartz | Level 8 NN
Quartz | Level 8

Thanks @ballardw and @Reeza for your solutions.

The macro option is a quick solution for my current need hence i shall go ahead with it.

AllanBowe
Barite | Level 11

If you ever need to reset that option back to it's original value, you could use this macro (inspired by @SASJedi ) : https://core.sasjs.io/mp__resetoption_8sas.html

/Allan
MacroCore library for app developers
Data Workflows, Data Contracts, Data Lineage, Drag & drop excel EUCs to SAS 9 & Viya - Data Controller
DevOps and AppDev on SAS 9 / Viya / Base SAS - SASjs

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 2712 views
  • 3 likes
  • 4 in conversation