This topic provides demos to get you started using the SAS client API.

Simple Demo

You can select (Export) > Script > SAS above most query views to export a script that selects the columns shown.

For example, performing this operation on the LabResults dataset in the example study, produces the following macro:

folderPath="/home/Demos/HIV Study Tutorial",

This SAS macro selects the rows shown in this custom grid into a dataset called 'mydata'.

Full SAS Demo

The archive attached to this page provides a SAS script and Excel data files. You can use these files to explore the selectRows, executeSql, insert, update, and delete operations of the SAS/LabKey Library.

Steps for setting up the demo:

  1. Make sure that you or your admin has Set Up SAS to use the SAS/LabKey Interface.
  2. Make sure that you or your admin has set up a .netrc file to provide you with appropriate permissions to insert/update/delete. For further information, see Create a netrc file.
  3. Download and unzip the demo files: The zip folder contains a SAS demo script ( and two data files (People.xls and MorePeople.xls). The spreadsheets contain demo data that goes with the script.
  4. Add the "Lists" web part to a folder on your LabKey Server if it has not yet been added.
  5. Create a new list called “People”, inferring the fields and importing the data by dragging and dropping the file People.xls into the list creation editor. Learn more in this topic: Create Lists.
  6. Create a second list called “MorePeople” using MorePeople.xls for inferring fields and importing data.
  7. Change the two references to baseUrl and folderPath in the to match your server and folder.
  8. Run the script in SAS.

Related Topics

Was this content helpful?

Log in or register an account to provide feedback

expand allcollapse all