| Date: | Tue, 14 Nov 2006 16:04:38 -0500 |
| Reply-To: | Peter Crawford <peter.crawford@BLUEYONDER.CO.UK> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Peter Crawford <peter.crawford@BLUEYONDER.CO.UK> |
| Subject: | Re: Chance to Make SAS-L History: Did You Know That... |
| Content-Type: | text/plain; charset=ISO-8859-1 |
On Mon, 13 Nov 2006 20:50:20 -0500, Don Henderson
<donaldjhenderson@HOTMAIL.COM> wrote:
a great idea ( which I'd like to extend..... below)
>Did you know that you can use the %sysfunc macro with the getoption
function
>to access the value of a single option, e.g.,
>
>%let source = %sysfunc(getoption(source));
>
>This can be very useful if you are writing generalized code where you want
>specific options set and then you want to reset them back at then end of
>your code. For example, suppose you want to turn off the source, source2
and
>mprint options, you can add the following to the top of your code:
>
>%let source = %sysfunc(getoption(source));
>%let source2 = %sysfunc(getoption(source2));
>%let mprint = %sysfunc(getoption(mprint));
>options nosource nosource2 nomprint;
>
>And then reset them back at the end of your code as follows:
>
>options &source &source2 &mprint;
>
>Note that some of the option values are returned in a form that is not
>conducive to referencing the values as above. For such options, you will
>need to generate the appropriate syntax.
>
>-don
>
As Mike Rhoads <RHOADSM1@WESTAT.COM> followed up to point out
the "keyword" parameter of the getoption() function eliminates
the problem Don refers to in his last paragraph, may I add a
small supplement
Suppose you have a macro parameter "quiet=" to support hiding
diagnostics and notes and source out of "activities" in a macro
It might hold a default value like
quiet= nosymbolgen nomprint nomlogic nonotes nosource2 nosource
nomprintnest nomlogicnest nomautolocdisplay
In production, your code would not need to set the value for this
parameter, but in development you might want
%whatever( quiet= mautolocdiaplay notes source mprint
%* the technique reduces the diagnostics options handling to the
use of this short macro ;
%macro getOp( op ) ;
%sysfunc( getoption( &op, keyword ))
%mend getOp ;
%*The Quiet parameter would be used in fragments of the macro,
like;
%* capture prevailing system options before resetting them ;
%local _opdOptions ;
%let _oldOptions = %mLoopsX( execut= getOp, with= &quiet ) ;
option &quiet ; %* hiding the diagnostics by applying the
&quiet option collection, requested in the macro call ;
..... regular processing ... as needed normally...
option &_oldOptions ; %* reinstating prevailing options;
That "list processing support macro" %mLoopsX() has been posted
in the SAS-L archives, and was the topic of SUGI31 paper
Paper 012-31: Peter Crawford
List Processing - Make Light Work of List Processing in SAS®`
http://www2.sas.com/proceedings/sugi31/012-31.pdf
Regards
Peter Crawford
http://www.technical-event.co.uk
>> -----Original Message-----
>> From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
>> Michael Raithel
>> Sent: Monday, November 13, 2006 5:16 PM
>> To: SAS-L@LISTSERV.UGA.EDU
>> Subject: Re: Chance to Make SAS-L History: Did You Know That...
>>
>> Dear SAS-L-ers,
>>
>> Did you know that: You can determine the specific setting of a SAS
option
>> without having to print out all of the SAS options and then weed through
>> the SAS log looking for it. Oh, yes it's true; simply code the
following:
>>
>> proc options option=bufno;
>> run;
>>
>> ...which produces the following one-liner in the SAS log for my SAS-
under-
>> Windows installation:
>>
>> BUFNO=1 Number of buffers for each SAS data set
>>
>> Pretty nifty, eh?
>>
>> Oh, if you are like me and want scads of information, you can add the
>> DEFINE and the VALUE keywords:
>>
>> proc options option=bufno define value;
>> run;
>>
>> That will get you a veritable book on the particular option:
>>
>> Option Value Information For SAS Option BUFNO
>> Option Value: 1
>> Option Scope: Default
>> How option value set: Shipped Default
>> Option Definition Information for SAS Option BUFNO
>> Group= SASFILES
>> Group Description: Library and member file information
>> Group= PERFORMANCE
>> Group Description: Performance settings
>> Description: Number of buffers for each SAS data set
>> Type: The option value is of type LONG
>> Range of Values: The minimum is 0 and the maximum is
2147483647
>> Valid Syntax(any casing): MIN|MAX|n|nK|nM|nG|nT|hex
>> When Can Set: Startup or anytime during the SAS Session
>> Restricted: Your Site Administrator can restrict modification of
this
>> option.
>> Optsave: Proc Optsave or command Dmoptsave will save this option.
>>
>> SAS-L-ers, best of luck to you in posting your own "Did you know that:"!
>>
>>
>> I hope that this suggestion proves helpful now, and in the future!
>>
>> Of course, all of these opinions and insights are my own, and do not
>> reflect those of my organization or my associates. All SAS code and/or
>> methodologies specified in this posting are for illustrative purposes
only
>> and no warranty is stated or implied as to their accuracy or
>> applicability. People deciding to use information in this posting do so
at
>> their own risk.
>>
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> Michael A. Raithel
>> "The man who wrote the book on performance"
>> E-mail: MichaelRaithel@westat.com
>>
>> Author: Tuning SAS Applications in the MVS Environment
>>
>> Author: Tuning SAS Applications in the OS/390 and z/OS Environments,
>> Second Edition
>> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>>
>> Author: The Complete Guide to SAS Indexes
>> http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>>
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> The computing field is always in need of new clich鳮 - Alan Perlis
>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>
>>
>>
>> > -----Original Message-----
>> > From: owner-sas-l@listserv.uga.edu
>> > [mailto:owner-sas-l@listserv.uga.edu] On Behalf Of Michael Raithel
>> > Sent: Thursday, November 02, 2006 1:18 PM
>> > To: SAS-L@LISTSERV.UGA.EDU
>> > Subject: OT: Chance to Make SAS-L History: Did You Know That...
>> >
>> >
>> > Dear SAS-L-ers,
>> >
>> > This is it! This is _YOUR_ chance to help make SAS-L history! You
>> > can do so by joining me in making this the longest thread that has
>> > ever existed in the storied history of this happy medium that we call:
>> > SAS-L. In doing so, you will not only help to make SAS-L history, you
>> > will also be an integral part of it!
>> >
>> > All that you have to do is contribute a single SAS tip to this thread.
>> > It doesn't necessarily have to be something profound; just solid and
>> > accurate.
>> >
>> > This opportunity is good for prolific posters, for occasional posters,
>> > for once-in-a-blue-moon posters, and especially for lurkers who have
>> > never posted before. Everybody on this list knows _SOMETHING_ about
>> > SAS. So, pick your best tip and post it--even if you are sure that
>> > others already know it. It could be that somebody doesn't know it, or
>> > that you refresh somebody's memory.
>> >
>> > So, here is how this will work. You simply write: "Did you know
>> > that: " and follow it up with your brief SAS tip. It couldn't be any
>> > easier, could it?
>> >
>> > Okay, so I'll get the ball rolling. Here goes:
>> >
>> > Did you know that: you can increase the page size of SAS indexes when
>> > they are first created by using the IBUFSIZE option? The default
>> > IBUFSIZE is 4096 bytes. You can change that setting by specifying
>> > IBUFSIZE=xxxxx. The author of a recent book on SAS indexes recommends
>> > setting IBUFSIZE=32767 (the maximum) on all SAS platforms except for
>> > z/OS, where he recommends setting it to 27648. (However, he presents
>> > the caution that this has not been rigorously tested on SAS data
>> > sets of varying sizes on _ALL_ of the operating systems that
>> > SAS is run on. So, your mileage may vary).
>> >
>> > Hey, that was easy. Now, it is your turn!
>> >
>> > If you need more incentive to participate, then consider these
>> > inspiring
>> > words:
>> >
>> > From this day to the ending of the world,
>> > But we in it shall be remember'd;
>> > We few, we happy few, we band of brothers (and sisters);
>> > For he (or she) to-day that posts with me Shall be my brother (or
>> > sister);
>> >
>> > I'll bet that did it. Okay, now get posting!
>> >
>> >
>> > I hope that this suggestion proves helpful now, and in the future!
>> >
>> > Of course, all of these opinions and insights are my own, and do not
>> > reflect those of my organization or my associates. All SAS code and/or
>> > methodologies specified in this posting are for illustrative purposes
>> > only and no warranty is stated or implied as to their accuracy or
>> > applicability. People deciding to use information in this posting do
>> > so at their own risk.
>> >
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> > Michael A. Raithel
>> > "The man who wrote the book on performance"
>> > E-mail: MichaelRaithel@westat.com
>> >
>> > Author: Tuning SAS Applications in the MVS Environment
>> >
>> > Author: Tuning SAS Applications in the OS/390 and z/OS Environments,
>> > Second Edition
>> > http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=58172
>> >
>> > Author: The Complete Guide to SAS Indexes
>> > http://www.sas.com/apps/pubscat/bookdetails.jsp?catid=1&pc=60409
>> >
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> > Be great in act, as you have been in thought. - William Shakespeare
>> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>> >
|