DATA Step, Macro, Functions and more

Getoption argument to %sysfunc 9.3 changes

Accepted Solution Solved
Reply
Contributor
Posts: 22
Accepted Solution

Getoption argument to %sysfunc 9.3 changes

Just installed SAS 9.3 (Windows 32-bit) today ... and was testing (I'm our site's software rep) ... and found the entirely unsatisfactory NOTE explanation in the LOG:

128   %let sopts=%sysfunc(getoption(missing,keyword)) %sysfunc(getoption(center,keyword))

NOTE: A conflicting combination of parameters was specified for the GETOPTION function.

129    %sysfunc(getoption(xwait,keyword)) %sysfunc(getoption(xsync,keyword))

129 ! %sysfunc(getoption(date,keyword))

NOTE: A conflicting combination of parameters was specified for the GETOPTION function.

NOTE: A conflicting combination of parameters was specified for the GETOPTION function.

NOTE: A conflicting combination of parameters was specified for the GETOPTION function.

130    %sysfunc(getoption(papersize,keyword))

131    %sysfunc(getoption(bottommargin,keyword)) %sysfunc(getoption(topmargin,keyword))

132    %sysfunc(getoption(rightmargin,keyword)) %sysfunc(getoption(leftmargin,keyword))

133    %sysfunc(getoption(orientation,keyword))

134   ;

Obviously the system options have changed for Version 9.3 ... and I'll need to look into that, but any hints as to code (within a macro) to use to check for the version of SAS being run?

Note that most of my end users will be using 9.2x for a while ... while some will start using 9.3 --- and I'll need to re-write this code to run as above for Version 9.2 ... and something I'll need to write new for Version 9.3.

Any hints/helps would be appreciated.

Thanks-Allen


Accepted Solutions
Solution
‎07-21-2011 02:34 PM
Respected Advisor
Posts: 3,777

Re: Getoption argument to %sysfunc 9.3 changes

What is the improvement with this new "feature"?


I see no use for the NOTE: but don't find it particularly offensive either.

Interestingly OPTSAVE stores all options in a KEYWORD format.  With the BOOLEANS as 0/1, just like I wish GETOPTION would do when KEYWORD is specified.

OBS    OPTNAME                  OPTVALUE

  1    APPLETLOC                C:\Program Files\SAS\SASGraphJ

  2    AUTOSAVELOC

  3    AUTOSIGNON               0

  4    BINDING                  DEFAULT

  5    BOMFILE                  1

  6    BOTTOMMARGIN             0.000 IN

  7    BUFNO                    1

  8    BUFSIZE                  0

  9    BYERR                    1

10    BYLINE                   1

11    BYSORTED                 1

12    CAPS                     0

13    CARDIMAGE                0

14    CBUFNO                   0

15    CENTER                   0

16    CGOPTIMIZE               3

17    CHARCODE                 0

18    CLEANUP                  1

19    CMDMAC                   0

20    CMPLIB

21    CMPMODEL                 BOTH

DICTIONARY. OPTIONS on the other hand has more info similar to what PROC OPTIONS can provide.

                                  Option                                                  Option

Option Name                       type      Option Setting         Option Description     Location  Option Group

ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

APPEND                            char                             Append at the end of   Portable  ENVFILES

                                                                   the option value

APPLETLOC                         char      C:\Program             Location of Java       Portable  ENVFILES

                                            Files\SAS\SASGraph     applets

                                            JavaApplets\9.2

ARMAGENT                          char                             ARM Agent to use to    Portable  PERFORMANCE

                                                                   collect ARM records

ARMLOC                            char      ARMLOG.LOG             Identify location      Portable  PERFORMANCE

                                                                   where ARM records are

                                                                   to be written

ARMSUBSYS                         char      (ARM_NONE)             Enable/Disable ARMing  Portable  PERFORMANCE

                                                                   of SAS subsystems

ASYNCHIO                          Boolean   NOASYNCHIO             Enable asynchronous    Portable  SASFILES

                                                                   input/output

AUTOSAVELOC                       char                             Identifies the         Portable  ENVDISPLAY

                                                                   location where

                                                                   program editor

                                                                   contents are auto

                                                                   saved

AUTOSIGNON                        Boolean   NOAUTOSIGNON           SAS/CONNECT remote     Portable  COMMUNICATIONS

                                                                   submit will

                                                                   automatically attempt

                                                                   to SIGNON

BINDING                           char      DEFAULT                Controls the binding   Portable  ODSPRINT

                                                                   edge for duplexed

                                                                   output

BOMFILE                           Boolean   BOMFILE                Add Byte Order Mark    Portable  EXTFILES

                                                                   when creating Unicode

                                                                   files

BOTTOMMARGIN                      char      0.000 IN               Bottom margin for      Portable  ODSPRINT

                                                                   printed output

BUFNO                             num       1                      Number of buffers for  Portable  PERFORMANCE

                                                                   each SAS data set

BUFSIZE                           num       0                      Size of buffer for     Portable  PERFORMANCE

                                                                   page of SAS data set

BYERR                             Boolean   BYERR                  Set the error flag if  Portable  ERRORHANDLING

                                                                   a null data set is

                                                                   input to the SORT

                                                                   procedure

BYLINE                            Boolean   BYLINE                 Print the by-line at   Portable  LISTCONTROL

                                                                   the beginning of each

                                                                   by-group

BYSORTED                          Boolean   BYSORTED               Require SAS data set   Portable  INPUTCONTROL

                                                                   observations to be

                                                                   sorted for BY

                                                                   processing

View solution in original post


All Replies
Respected Advisor
Posts: 3,777

Getoption argument to %sysfunc 9.3 changes

The NOTE: seems harmless enough to me.  I don't see any need to change the programs.

The thing the I don't understand is why SAS doesn't return the boolean options CENTER DATE XSYNC etc in KEYWORD form when you ask for it.

SAS does accept the KEYWORD from for setting the options.

1737  options xwait=0 xsync=0 date=0;

1738  %put %sysfunc(getoption(missing,keyword)) %sysfunc(getoption(center,keyword));

MISSING=. NOCENTER

1739  %put %sysfunc(getoption(xwait,keyword)) %sysfunc(getoption(xsync,keyword)) %sysfunc(getoption(date,keyword));

NOXWAIT NOXSYNC NODATE

Seem like if you can set the option as a KEYWORD that at least you could retrieve it the same way.

Contributor
Posts: 22

Getoption argument to %sysfunc 9.3 changes

Interestingly ... after I looked into this some more myself as well as your reply --- I now realize that in 9.2 it was ignoring the KEYWORD parameter for the boolean type of system options ... and that I can get what I want by removing the KEYWORD option for those system options ... and that the code will work in both 9.2 and 9.3!!!

THANKS-Allen

SAS Employee
Posts: 104

Getoption argument to %sysfunc 9.3 changes

>any hints as to code (within a macro) to use to check for the version of SAS being run?

Automatic macro variables you might find interesting when writing macro code to run in a multi-version SAS environment include:

SYSVER - SAS release version (Examples: 9.2, 9.3)

SYSVLONG - SAS release number and maintenance level (Examples: 9.02.02M3P041310, 9.03.01M0P051811)

SYSVLONG4 - Everything in SYSVLONG, plus the 4 digit year of the release (Examples: 9.02.02M3P04132010 , 9.03.01M0P05182011)

Super User
Super User
Posts: 6,500

Getoption argument to %sysfunc 9.3 changes

Use %sysevalf( &sysver > 9.2) to test if you are running a version newer than 9.2.

I agree that the NOTE is inappropriate.  It does seem strange that even when you ask for keyword format it does not return it, but changing the output now might break old code.

Also I would like them to fix the strings returned for values that require quotes when assigning the values.

For example if you try this code you will get error messages:

options missing=" ";

%let sopt=%sysfunc(getoption(missing,keyword));

options &sopt;

What I have done is something like:

%let sopt=formchar="%qsysfunc(getoption(missing))";

Here is the list of options that I indentified a couple of years ago that require that treatment.

missing invaliddata formchar formdlim topmargin leftmargin rightmargin bottommargin xprintnm printerpath

Respected Advisor
Posts: 3,777

Getoption argument to %sysfunc 9.3 changes

I think all those problems can be avoided if you are saving options to reset later by using OPTSAVE/OPTLOAD.

Valued Guide
Posts: 2,175

Getoption argument to %sysfunc 9.3 changes

are invocation-only options now supported in optload/optsave?

Respected Advisor
Posts: 3,777

Getoption argument to %sysfunc 9.3 changes

I don't know about SAS 9.3

For options that can only be specified at invocation what would be the point?

SAS 9.2 they are NOT saved but they are available for viewing or other processing (sans reset) with DICTIONARY.OPTIONS.

Valued Guide
Posts: 2,175

Getoption argument to %sysfunc 9.3 changes

thought so

and agree

for retrieving option values, sashelp.voption will have to become the source.

I liked the consistent re-usability of a short macro to conveniently collect the value of any option without needing to verify whether Boolean or in need of the keyword when the existing value is to be reused.

Looks like the new macro will have to go through the table handling scl-type functions rather than just supporting

%macro sy(op);

%sysfunc( getoption( &op, keyword))

%mend  sy ;

What is the improvement with this new "feature"?

Solution
‎07-21-2011 02:34 PM
Respected Advisor
Posts: 3,777

Re: Getoption argument to %sysfunc 9.3 changes

What is the improvement with this new "feature"?


I see no use for the NOTE: but don't find it particularly offensive either.

Interestingly OPTSAVE stores all options in a KEYWORD format.  With the BOOLEANS as 0/1, just like I wish GETOPTION would do when KEYWORD is specified.

OBS    OPTNAME                  OPTVALUE

  1    APPLETLOC                C:\Program Files\SAS\SASGraphJ

  2    AUTOSAVELOC

  3    AUTOSIGNON               0

  4    BINDING                  DEFAULT

  5    BOMFILE                  1

  6    BOTTOMMARGIN             0.000 IN

  7    BUFNO                    1

  8    BUFSIZE                  0

  9    BYERR                    1

10    BYLINE                   1

11    BYSORTED                 1

12    CAPS                     0

13    CARDIMAGE                0

14    CBUFNO                   0

15    CENTER                   0

16    CGOPTIMIZE               3

17    CHARCODE                 0

18    CLEANUP                  1

19    CMDMAC                   0

20    CMPLIB

21    CMPMODEL                 BOTH

DICTIONARY. OPTIONS on the other hand has more info similar to what PROC OPTIONS can provide.

                                  Option                                                  Option

Option Name                       type      Option Setting         Option Description     Location  Option Group

ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ

APPEND                            char                             Append at the end of   Portable  ENVFILES

                                                                   the option value

APPLETLOC                         char      C:\Program             Location of Java       Portable  ENVFILES

                                            Files\SAS\SASGraph     applets

                                            JavaApplets\9.2

ARMAGENT                          char                             ARM Agent to use to    Portable  PERFORMANCE

                                                                   collect ARM records

ARMLOC                            char      ARMLOG.LOG             Identify location      Portable  PERFORMANCE

                                                                   where ARM records are

                                                                   to be written

ARMSUBSYS                         char      (ARM_NONE)             Enable/Disable ARMing  Portable  PERFORMANCE

                                                                   of SAS subsystems

ASYNCHIO                          Boolean   NOASYNCHIO             Enable asynchronous    Portable  SASFILES

                                                                   input/output

AUTOSAVELOC                       char                             Identifies the         Portable  ENVDISPLAY

                                                                   location where

                                                                   program editor

                                                                   contents are auto

                                                                   saved

AUTOSIGNON                        Boolean   NOAUTOSIGNON           SAS/CONNECT remote     Portable  COMMUNICATIONS

                                                                   submit will

                                                                   automatically attempt

                                                                   to SIGNON

BINDING                           char      DEFAULT                Controls the binding   Portable  ODSPRINT

                                                                   edge for duplexed

                                                                   output

BOMFILE                           Boolean   BOMFILE                Add Byte Order Mark    Portable  EXTFILES

                                                                   when creating Unicode

                                                                   files

BOTTOMMARGIN                      char      0.000 IN               Bottom margin for      Portable  ODSPRINT

                                                                   printed output

BUFNO                             num       1                      Number of buffers for  Portable  PERFORMANCE

                                                                   each SAS data set

BUFSIZE                           num       0                      Size of buffer for     Portable  PERFORMANCE

                                                                   page of SAS data set

BYERR                             Boolean   BYERR                  Set the error flag if  Portable  ERRORHANDLING

                                                                   a null data set is

                                                                   input to the SORT

                                                                   procedure

BYLINE                            Boolean   BYLINE                 Print the by-line at   Portable  LISTCONTROL

                                                                   the beginning of each

                                                                   by-group

BYSORTED                          Boolean   BYSORTED               Require SAS data set   Portable  INPUTCONTROL

                                                                   observations to be

                                                                   sorted for BY

                                                                   processing

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 9 replies
  • 1345 views
  • 6 likes
  • 5 in conversation