SAS SCL Lists (slists) - an Overview

What is SCL?

Mention AF or SCL to someone who has been in the SAS game for more than a decade or so, and you can be sure there will be a story to tell.  The technology, built by pioneers such as Deva Kumaraswamy, was used to build many of the original SAS client products.  And a significant number of SAS customers still have production SCL solutions in operation today.  It is an object orientated framework that can write and execute base code (like SAS Macro), store object methods (like java) and be linked to Frames (like VBA).

SAS AF Frame

What is an SCL List (SLIST) ?

When building complex applications in any language, there will be a need to dynamically store and share unstructured data.  These days it will typically be XML or JSON, but with SCL it was - the SLIST.

The SLIST is more concise than XML (no tags) and similar to JSON (which didn't come out until 2001).  It is incredibly fast as it lives in memory - like a format or hash table.  Item names can be 255 characters, and character values can be up to 32,766 in length.  They can be stored in SAS Catalogs, and - when exported - look like this:

Screen Shot 2017 12 03 at 17 39 25 269x300

Some things to note:

  • the slist name (in this case, SLIST)
  • Name / value pairs, along with a type (can be C, N, L or O)
  • An slist can contain sublists (in this case, two)
  • Each slist finishes with a list identifier.  This is a temporary, unique id - analogous to the dataset identifier returned in the regular base SAS open() function.

Working With Slists

Slists can be created in many ways (declare statement, in a class file, using copylist).  Our example will use the makelist() function.  This function will create a new list, and return the identifier for that list.

The functions which populate an slist vary in name depending on how the list item is updated (eg by name or index position) and by the type of item being updated (eg List / Object / Character / Numeric).  The three main function groups are below:

  • INSERTX (insertl / inserto / insertc / insertn).  These functions add new items to an SCL list.
  • SETITEMX (setiteml / setitemo / setitemc / seitemn).  These functions update list items by position.
  • SETNITEMX (setniteml / setnitemo / setnitemc / setnitemn).  These functions update list items by name.

To view the contents of an slist you can save to a catalog (eg with savelist) or just print to the log with call putlist().

Here's an example of this in action.

Hopefully this has helped to make sense of the mysterious slist!

Cool Story Bro.

The chances are, if you're reading this, you've either developed or managed a legacy SAS/AF solution in the past.  As powerful and robust as this technology is, it has inherent challenges with regard to security, scalability, and supportability.  It can also be a major blocker if you're looking to modernise your SAS environment and move away from using a desktop SAS thick client.

We specialise in helping clients migrate full client legacy AF into thin-client Stored Process Web Applications using our SCL Transcoding Kit and the SASjs framework.  Your existing, trusted SCL logic can be reused, called as SAS services from a modern HTML5 web application served by the SAS mid-tier.   Adding / removing new users is a piece of cake (no need for desktop access or changing configs on network drives).  As a web app, the solution is not only secure, scalable and fully supportable - it looks great!

For more info, do reach out on Linkedin.