Querying SAS option status in Base SAS
Posted by Paul at 2:24 pm
Some SCL functions are available to Base SAS but you cannot use the SCL functions OPTGETN and OPTGETC to find out what the current status of certain SAS Options are.
In this case you can use the OPTSAVE and OPTLOAD Base SAS procedures.
For example, if you wanted to query the current MPRINT and NOTES option settings so that you could change the options temporarily and then return them to the original values then you could use the following Base SAS code:
* Retain the current MPRINT and NOTES options in a dataset *; proc optsave out=_sysoptions (where=(optname in ('MPRINT' 'NOTES'))); run; * Force the options to not display generated macro code/notes *; options nomprint nonotes; .. other SAS macro code here ... * Reset the options back to their original values *; proc optload data=_sysoptions; run;
You might want to do this where an external SAS macro called a sub-macro and the external macro may have the MPRINT/NOMPRINT and NOTE/NONOTES options set. You could then force the options to not display macro code and program notes while the sub-macro is running, but return the settings to their original values after sub-macro execution is complete.