sasjs / server

Build Apps on Base SAS
https://server.sasjs.io
MIT License
20 stars 3 forks source link

support request file inputs #16

Closed allanbowe closed 2 years ago

allanbowe commented 2 years ago

When files are uploaded to SAS (/SASjsExecutor endpoint) we need to make them available to the SAS session. Ideally they will be loaded into SASWORK, but until we find a nice way to handle a running SAS Session, we should proceed as follows:

  1. Create a temporary directory in which to store the files
  2. Insert some SAS code to enable the session to reference those files
  3. After execution, delete the directory.

The SAS code to be inserted consists of the following variables:

We will also create the fileref(s) using the filename statement.

To illustrate with an example - we are uploading two files, F1 and F2. The following SAS code will be generated, and inserted at the beginning of the executed program:

filename _SJS0001 "/some/temp/location/file1";
filename _SJS0002 "/some/temp/location/file2";
%let _WEBIN_FILE_COUNT=2;
%let _WEBIN_FILENAME1=/some/temp/location/file1;
%let _WEBIN_FILENAME2=/some/temp/location/file2;
%let _WEBIN_FILEREF1=_SJS0001;
%let _WEBIN_FILEREF2=_SJS0002;
%let _WEBIN_NAME1=F1;
%let _WEBIN_NAME1=F2;

If there are no files uploaded, only the following code will be generated:

%let _WEBIN_FILE_COUNT=0;
allanbowe commented 2 years ago

delivered in https://github.com/sasjs/server/pull/23