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:
Create a temporary directory in which to store the files
Insert some SAS code to enable the session to reference those files
After execution, delete the directory.
The SAS code to be inserted consists of the following variables:
_WEBIN_FILE_COUNT - contains an integer, from 0 to the number of files to being provided. This variable is always created.
_WEBIN_FILENAME1 - The full path to the first file (including the filename). The path to the second file will be _WEBIN_FILENAME2 (and so on, same for the below)
_WEBIN_FILEREF1 - An 8 letter code, starting with an underscore and finishing with 7 random alphanumeric characters
_WEBIN_NAME1 - the value that was specified in the NAME attribute by the frontend
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:
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:
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:
If there are no files uploaded, only the following code will be generated: