When: After platform changes
It is common to customize your SAS Programming Run-Time environment to better suit your organization's particular needs, using some combination of useful SAS statemments in autoexec code blogs. These statements are executed as SAS sessions are initialized, so that their effects are already in place by the time your users' program statements run.
Consider:
- Which autoexec statements are useful and represent good value for their resource costs (e.g. do they increase session startup time, consume memory etc.) ?
- To which SAS Programming Run-Time Sessions do you wish them to apply - what is their scope?
The following SAS statements are examples of the kind of statements commonly used by customers in autoexec code. This is NOT a list of recommended statements - you do not have to apply each of these in your environment, and you may not like what some of them do! The list of examples below is intended to illustrate the variety and breadth of things an administrator can adjust if desired.
Topic | Examples | What these can be used for |
---|---|---|
Custom SAS macros | %macro exist(dsn); %global exist; %if %sysfunc(exist(&dsn)) %then %let exist=YES; %else %let exist=NO; %mend exist; |
SAS macros that are widely used in many of your SAS programs. Instead of defining the same macro in many programs, why not add them directly, or via some other method (%include, autocall macro libraries) to all Programming Run-Time sessions where they might be useful? See more examples for inspiration in Advanced Macro Topics: Utilities and Examples [Paper], or search the web for something like "useful SAS utility macros". |
FULLSTIMER option | option fullstimer; (or option nofullstimer; ) |
The SAS System provides the FULLSTIMER option to collect performance statistics on each SAS step, and for the job as a whole and place them in the SAS log. This makes SAS program log output longer and more verbose. See FULLSTIMER SAS Option for a detailed explanation. |
SAS Macro Debugging Options and %put statements |
option mlogic; option mprint; option symbolgen; (or option nomlogic; option nomprint; option nosymbolgen; )%put _all_; %put macro_variable; |
Prints detail of what macro calls resolve to and the values of macro variables at run time to the SAS program logs. Makes macro log output more verbose. See Debugging Techniques [Doc] |
SORTSIZE= System Option and MEMSIZE System Option | option sortsize=2G; option memsize max; |
See SORTSIZE= System Option and MEMSIZE System Option, and do not modify these values until you understand what you are doing. If used correctly, these tuning parameters can greatly improve program performance and stability. If used incorrrectly they can adversely affect performance and stability. Must be used carefully in combination with adjustments to memory requests and limits in Programming Run-Time PodTemplates |
Mail server options | options emailsys=smtp emailhost=mailhost.company.com emailport=25; |
Configure corporate mail server access, to allow SAS programs to send email. End users may not know what values to provide for these options, whereas a SAS Administrator can find out and set them for everyone. |
Pre-assign commonly-used libraries | libname hrdata "/gelcontent/gelcorp/hr/data"; |
Assign a library at the compute context, or global compute server level. This method of globally pre-assigning a library is one of several valid methods available to the SAS Administrator. |
The task Modify Launcher and SAS Programming Run-Time Server Contexts [Task] describes several places where configurations settings can be applied. In this task, we focus primarily on:
- Global Compute/Connect/Batch Server configuration instances' autoexec code blocks
- Compute/Connect/Batch contexts' autoexec code blocks
If you want all compute, connect or batch sessions to be impacted by an autoexec statement, you should place it in the respective server's configuration instance defining its autoexec code.
See Server Configuration Instances for a list of configuration instances, and notice those for autoexec_code in particular.
Step by step instructions for how to modify any of them are given in Edit Configuration Instances - scroll down a little from that section heading to see the steps.
Note: SAS Viya has no 'universal' autoexec code block which would apply to all three of compute, connect and batch servers, but with a bit of effort, you can make your own. If you have a shared volume mounted into each type of server, you could place a file containing your 'global' autoexec statements on that shared volume, with appropriate read-only permissions for most users, and %include the same file in each of your deployment's compute, connect and/or batch autoexec code blocks.
If you want only compute, connect or batch sessions running under specific contexts to be impacted by an autoexec statement, place the statement in the relevant context's specific autoexec code block.
Step by step instructions for how to modify any of them are given in Edit a Context in the SAS Environment Manager's user guide.
You may alternatively prefer to create a new Compute, Connect or Batch context. Contexts can be available to all authenticated users, or to selected users only. See:
See also Where to configure the SAS Programming Run-time with broader or narrower scope [Blog], which describes the places where configurations settings can be applied, and discusses why you might choose each one.