Simple Demo

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

For example, performing this operation on the custom grid shown here: Grid View: Join for Cohort Views in the Demo Study produces the following SQL:

%labkeySelectRows(dsn=mydata,
baseUrl="https://www.labkey.org",
folderPath="/home/Study/demo",
schemaName="study",
queryName="Lab Results",
viewName="Grid View: Join for Cohort Views");

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

Full SAS Demo

The sas-demo.zip 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 on your LabKey Server.
  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 or _netrc file.
  3. Download and unzip the demo files: sas-demo.zip. The zip folder contains a SAS demo script (demo.sas) 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 portal page of a folder on your LabKey Server if it has not yet been added to the page.
  5. Create a new list called “People” and choose the “Import from file” option at list creation time to infer the schema and populate the list from People.xls.
  6. Create a second list called “MorePeople” and “Import from file” using MorePeople.xls.
  7. Change the two references to baseUrl and folderPath in the demo.sas to match your server and folder.
  8. Run the demo.sas script in SAS.

Discussion

previousnext
 
expand all collapse all