Select Page

The conundrum – I needed to run SCL on a windows machine without Base SAS (only EG) connecting to a Linux backend.

The obstacle – it is not possible to programmatically create an SCL catalog entry in batch mode.

The solution – read on!

Thankfully I did have access to a windows machine with Base SAS.  Taking inspiration from this post (thanks Robin) the steps were as below.  If you do not need to switch environments / operating systems, you can skip steps 2 and 3.

1 – Create an SCL Entry

Unfortunately, it is absolutely necessary to create an SCL file manually.  The good news is that you can do this just once, and write an entry that will simply %include any future SCL you send to it.  To create this file and corresponding catalog at the same time, use the build command:

This should open a window with the SCL entry.  Now add a single line of code (%inc fref;) and save the file.

What just happened?  We created an SCL entry in a catalog, which will run an %include statement from a fileref (fref) once compiled.

2 – Export the Catalog

The catalog we created in step one (with one SCL entry and one line of code) now needs to be ‘ported’ to a transferrable format.  See CPORT:

PROC CPORT LIBRARY=sasuser FILE=‘C:temptrans.exp’ memtype=catalog;
      select batchaf; 
RUN;

The above file then needs to be manually (or otherwise) transferred to a location that the new environment can read from.

3 – Import the Catalog

Can use EG for this!  In my case I also needed to remove the ‘read only’ attribute from the sasuser library.

libname sasuser “%sysfunc(pathname(sasuser))”;
PROC CIMPORT LIBRARY=sasuser INFILE=“/your/landing/area/trans.exp”
RUN;

We now have our catalog available to use in the correct (binary) format.

4 – Run some SCL

The part we’ve been waiting for!  The steps here are to create our SCL (in fref), compile it and finally to run it (via proc display).

filename fref temp;
data _null_;
file fref;
input ;
put _infile_;
cards4;
INIT:
  scrn=screenname();
  path=pathname(‘sashelp’);
  put “excecuted ” scrn= path=;
Return;
;;;;
run;
proc build batch c=sasuser.batchaf;
  compile select=builder.scl;
run;
proc display c=sasuser.batchaf.builder.scl;run;

Of course this whole post is only relevant to you if you have SAS/AF installed on your server (check proc setinit for a —SAS/AF entry).

Enjoy..