SAS Administration: Change the Options to Get More Performance

This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post.

Every time I install SAS products or solutions I find myself using the same options in the SAS configuration file to set memory usage, CPU usage, and the SAS WORK library location.  Obviously each installation has different thresholds configured but the options remain the same.  In some situations not having the performance options set can lead to problems if you’re working with large datasets or building a big OLAP cube.  Having the ability to set the SAS WORK library to a different location is also beneficial if you have separate storage options.  You can also improve the general performance of the SAS server by configuring and tuning options to meet your needs.  As always, check with your SAS or IT administrator to see what capabilities exist and how you can maximize these options!

Typical SAS Server Configuration Options

Here is the typical configuration I copy and paste into every SAS configuration file:

options

Configuration files can be found all over the place.  I typically change these two files:

  • ….config/Lev1/SASApp/sasv9_usermods.cfg
  • [SAS HOME]/SASFoundation/9.3/sasv9_local.cfg

SAS Support has plenty of documentation on the order of precedence for SAS configuration files.

Important Note: Add options to the “usermods” version of configuration files as a general best practice. Doing this will prevent SAS from overwriting when software is upgraded.

Important Note 2: Every operating system environment is different and may have different options. For example, Windows uses a different file system path than UNIX/Linux.  This blog post uses Linux x64 operating environment.

Setting the SAS WORK Library Location and Default Permissions

If you have the option of mounting additional space or hard disks for your SAS WORK library you can set the library location using this parameter.  The SAS WORK location is one of the most intense areas of activity in terms of IO throughput because practically every SAS process uses the WORK library for temporary data needs.   Segmenting this activity on a dedicated mount point is ideal for maximum WORK library performance.

-work '/saswork'

In some cases, it may be necessary to set the default file system permissions for the SAS WORK library when information is written.  Use the ‘workperms’ option to configure this.

-workperms 777

Check out SAS Support for more documentation on setting the WORK library location and setting the default WORK library file system permissions.

Setting the Number of CPU Cores and Enabling Threading

Another good practice is to let SAS know how many CPU processors exist in your environment and if these processors support multi-threading.  In large production environments it is better to limit how many CPU cores SAS uses, especially if threading is enabled, to prevent over-loading the system.  For example, I generally limit the number of cores to 25-50% of the actual number of cores.  Otherwise as the load increased, SAS can potentially consume all available CPU cores and impact overall performance.

-cpucount 4
-threads

Only certain SAS procedures take advantage of threading and parallel CPU activity.  I typically see improvements using the PROC SORT and PROC SQL steps.

Check out SAS Support for more documentation on setting the CPU count and enabling threading.

Setting Memory Options for SAS

These are a few memory options which should be configured together.  Use these options to limit the amount of memory SAS has available per process.  A good practice I follow, which was passed on through SAS Tech Support troubleshooting, is to set the REALMEMSIZE, SUMSIZE, and SORTSIZE to approximately 75% of the total MEMSIZE.

-memsize 4G
-realmemsize 3G
-sumsize 3G
-sortsize 3G

Check out SAS Support for more documentation on configuring memory options.

Setting Buffer Size for Writing SAS Datasets

The last option I typically set is the buffer size for writing SAS datasets.  You want this to be greater than or equal to the file system block size for where SAS datasets are written.  The larger the buffer size for SAS datasets, the less SAS has to read or write to the physical storage device.  This comes at a cost of consuming more physical memory.  Larger buffer sizes should be in multiples of the file system block size to minimize how many times SAS has to access the file system.  I typically go with values between 4K to 2M depending on the environment.

-bufsize 4096

As always, check out SAS Support for more documentation on setting the buffer size.  Also read this technical support paper for increasing IO throughput – has a lot of good low-level detail!

Display Current SAS Options

Here is a quick line of code that will show you your current SAS configuration in the log:

proc options; run;

You can add the “performance” parameter to focus just on performance related options:

proc options group=performance; run;

Hopefully these options will at least open some people’s eyes to simple options which can drastically improve performance or prevent problems.

Please reply with any additional useful options and the situations you have used them for!

The post SAS Administration: Change the Options to Get More Performance appeared first on Business Intelligence Notes for SAS® BI Users. Written by .

This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post.