|
On 27 Jan 04 14:56:52 GMT, chang_y_chung@HOTMAIL.COM (Chang Y. Chung)
wrote:
>Hi,
>
>Does anybody have a macro that makes easy to save/restore sas system
>options? I think I saw something like it somewhere, but could not remember
>where I did that. I am thinking about doing something like in the below.
>Thanks in advance.
>
>Cheers,
>Chang
>
>%saveOptions;
> ...
> temporarily change some options and do something useful
> ...
>%restoreOptions;
I've designed such an animal in the past, although never implemented
it. In essence, all you'd need to do would be run proc options to an
external file, read the results back in and store as a sas dataset,
filtering out lines not required. This latter part will be the most
tricky - the rest could be written in two minutes, something like:
%macro saveOptions ;
proc printto log=myfile ;
proc options ;
proc printto;
data options;
infile myfile;
length option $ 80 ;
input option ;
if option not in ('','Portable'); /* Add other garbage values */
run;
%mend;
Obviously, there are many refinements you could use to make this
simpler/better, but it might provide a basis for your code.
The restoreOptions mcro would then read the stored dataset and simply
generate a Call Execute for each line, or write to a temp file and
%include it. A further refinement would be for it to re-read the
current options and only reset those that had been changed.
HTH
--
Ace in Basel - brucedotrogers a.t rochedotcom
|