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
SAS Challenges - SASensei
MacroCore library for app developers
SAS networking events (BeLux, Germany, UK&I)

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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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