Set up SAS to use the SAS/LabKey Interface
The LabKey/SAS client library is a set of SAS macros that retrieve data from an instance of LabKey Server as SAS data sets. The SAS macros use the Java Client Library to send, receive, and process requests to the server.Configure your SAS installation to use the SAS/LabKey interface:
- Install SAS
- Retrieve the latest ClientAPI-SAS.zip file (e.g., LabKey<version>-ClientAPI-SAS.zip) from the "All Downloads" tab on the LabKey Server download page.
- Extract this file to a local directory (these instructions assume "c:\sas"). The directory should contain a number of .jar files (the Java client library and its dependencies) and 12 .sas files (the SAS macros).
- Open your default SAS configuration file, sasv9.cfg (e.g., in c:\Program Files\SASHome\x86\SASFoundation\9.3\nls\en)
- In the -SET SASAUTOS section, add the path to the SAS macros to the end of the list (e.g., "C:\sas")
- Configure your Java Runtime Environment (JRE) based on your SAS version:
- Instructions for SAS 9.3
- Install the SAS update TS1M2, in order to run it with Java 7, instead of Java 6 (which is the default for SAS 9.3)
- Near the top of sasv9.cfg, add -set classpath "<full paths to all .jar files separated by ; (on Windows) or : (on Mac)>" (see below)
- Instructions for SAS 9.4
- No configuration of the Java runtime is necessary on SAS 9.4 since it runs a private Java 7 JRE, installed in the SASHOME directory
- Near the top of sasv9.cfg, add -set classpath "<full paths to all .jar files separated by ; (on Windows) or : (on Mac)>"; (see below)
Example Java classpath for Windows:
-set classpath "C:\sas\commons-codec-1.6.jar;C:\sas\commons-logging-1.1.3.jar;C:\sas\fluent-hc-4.3.5.jar;C:\sas\httpclient-4.3.5.jar;C:\sas\httpclient-cache-4.3.5.jar;
Example Java classpath for Mac:
Configure LabKey Server and run the test script:
-set classpath "/sas/commons-codec-1.6.jar:/sas/commons-logging-1.1.3.jar:/sas/fluent-hc-4.3.5.jar:/sas/httpclient-4.3.5.jar:/sas/httpclient-cache-4.3.5.jar:
- On your local version of LabKey Server, configure a list called "People" in your home folder and import demo.xls to populate it with data
- Configure your .netrc or _netrc file in your home directory. For further information, see: Create a netrc file.
- Run SAS
- Execute "proc javainfo; run;" in a program editor; this command should display detailed information about the java environment in the log. Verify that java.version matches the JRE you set above.
- Load demo.sas
- Run it