Help using Base SAS procedures

proc options question

Reply
Frequent Contributor
Posts: 100

proc options question

Experts:

If you only need to find out a few specific system options, what is the most efficient way?

I tried a couple ways and failed:
proc options option = pagesize option=linesize;
proc options options = pagesize linesize;

I studied the Help. The group = is certainly better than just proc options;
Any better ways?
Thank you!
the lazy beginner
Occasional Contributor
Posts: 14

Re: proc options question

proc options;
run;
can be used to check all default options.

Proc options
group =errorHandling;
Run ;

can be used to check certain group of options;

proc options option = pagesize ;
run;

can be used to check single option.

However, I am beginner too. Waiting for real expert to answer your question.
Frequent Contributor
Posts: 106

Re: proc options question

If by 'specific' you mean that you exactly know the option's name then I prefer things like
[pre]
%* display selected options on log ;
%put %sysfunc(getoption(linesize,keyword)) ;
%put %sysfunc(getoption(pagesize,keyword)) ;
[/pre]
If you change these options within a SAS session (be it foreground or background) temporarily, good practice is to do it somewhat like
[pre]
%let _ls = %sysfunc(getoption(linesize,keyword)) ;
%let _ps = %sysfunc(getoption(pagesize,keyword)) ;
options linesize=200 pagesize=100 ; /* hypothetic values */
%* do some SAS things here ;
options &_ls &_ps ;
[/pre]
Alternatively you could use procedures OPTSAVE and OPTLOAD to front-end temporary modifications.
Frequent Contributor
Posts: 100

Re: proc options question

Posted in reply to Robert_Bardos
Great suggestions! Also helped me to learn more about SAS macro. (I've only read briefly about the topic before.) Thank you!
Valued Guide
Posts: 2,177

Re: proc options question

when wanting the value of system options, avoid typing with a macro like:
%macro sy(op) /des='get system option with keyword' ;
%sysfunc( getoption(&op, keyword))
%mend sy ;
then
%put %sy(ls) %sy(ps) %sy(sasautos);
becomes a concise and convenient way to check the value of an option (not much more than the option name itself !)
similarly
%let old_opts = %sy(mlogic) %sy(mprint) %sy(symbolgen) ;
provides a brief way to collect and store options before changing them, as you might want when you start some more macro development

learn the convenience of placing your macros in your sasautos folder and inserting your sasautos folder at the beginning of the SASAUTOS system option, with something like
option sasautos=( mymacros sasautos ) ;
in your autoexec.sas

good luck
peterC
Frequent Contributor
Posts: 100

Re: proc options question

Awesome. I'm going to file this one for the days when the word macro no longer intimidates me!
Frequent Contributor
Posts: 100

Re: proc options question

Thank you. There is so much to learn!
SAS Employee
Posts: 19

Re: proc options question

I'm replying to your original question.
Using proc options to check multiple formats is just fine. The first way you presented it is correct and will work. You said it did not work? (Your second method will produce an error. Since you didn't have "option=" before "linesize, SAS trys to interpret "linesize" as another option for the procedure and fails.)

You can also add the option 'value' and you will get more information, e.g.

proc options option=pagesize option=linesize value;
run;
Frequent Contributor
Posts: 100

Re: proc options question

Posted in reply to martha_sas
Thank you for the reply. I double-checked. Here is the log I got. For some reason, only the value for second option comes back.

1 proc options option = pagesize option=linesize;
2 run;

SAS (r) Proprietary Software Release 9.2 TS2M2

LINESIZE=96 Line size for SAS log and SAS procedure output
NOTE: PROCEDURE OPTIONS used (Total process time):

3 proc options option = pagesize option=linesize value;
4 run;

SAS (r) Proprietary Software Release 9.2 TS2M2

Option Value Information For SAS Option LINESIZE
Option Value: 96
Option Scope: DMS Process
How option value set: Unknown
NOTE: PROCEDURE OPTIONS used (Total process time):
SAS Employee
Posts: 19

Re: proc options question

Now I know why it works for me and not you. You're running SAS 9.2m2 and I was using 9.3. At 9.2m2 you can only get information on one option at a time. At 9.3 there's more flexibility and you can even to this:
proc options option=(linesize pagesize);
But you can't do that at 9.2m2.

I didn't realize that until I saw your log which version you were using.
Frequent Contributor
Posts: 100

Re: proc options question

Posted in reply to martha_sas
I see. I didn't consider the possibility of version difference at all. Thank you.
Super User
Posts: 10,020

Re: proc options question

There is a dictionary table (dictionary.options) which can do the same thing.
[pre]
proc sql;
select optname,setting
from dictionary.options
where optname in ('LINESIZE' 'PAGESIZE' 'COMPRESS');
quit;

[/pre]


Ksharp
Frequent Contributor
Posts: 100

Re: proc options question

Thank you. Tried and it worked nicely.
Ask a Question
Discussion stats
  • 12 replies
  • 467 views
  • 0 likes
  • 6 in conversation