LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (January 2004, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 27 Jan 2004 16:40:15 +0100
Reply-To:   Ace <b.rogers@VIRGIN.NET>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ace <b.rogers@VIRGIN.NET>
Subject:   Re: Macro to save/restore options
Content-Type:   text/plain; charset=us-ascii

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


Back to: Top of message | Previous page | Main SAS-L page