Published on :
Administration CREATION_INTERNE

SAS Viya Platform File Service

This code is also available in: Deutsch Español Français
Attention : This code requires administrator privileges.
The SAS© Viya Platform File Service allows users to interact with files stored in the SAS© Infrastructure Data Server. Each file is identified by a UUID generated upon its creation. Although a unique name is assigned, it can be modified by the user, which may lead to duplicates. Files are accessed via their file identifier (UUID) found in the URI. The service does not manage 'folders' but allows associating files using the PARENTURI= option, which specifies a relative URI for a SAS© Viya platform object, enabling the creation of file collections.
Data Analysis

Type : CREATION_INTERNE


Examples use SASHELP data (sashelp.class) for file creation.

1 Code Block
DATA STEP
Explanation :
This example shows how to create a 'class.csv' file from the 'sashelp.class' table using a DATA step. The file is then attached to a specific job using the PARENTURI= option of the FILENAME FILESVC statement. The file service uses this URI to link the output file to the job with identifier '5a308aa7-1c3a-4465-a14c-fd69a9091926'. Each row of 'sashelp.class' is formatted as CSV and written to the 'class.csv' file.
Copied!
1filename jobout filesrvc
2 parenturi='/jobExecution/jobs/5a308aa7-1c3a-4465-a14c-fd69a9091926';
3DATA _null_;
4 SET sashelp.class;
5 file jobout('class.csv');
6 put name "," sex "," age "," height "," weight;
7RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : Copyright © SAS Institute Inc. All Rights Reserved


Banner
Expert Advice
Expert
Michael
Responsable de l'infrastructure Viya.
« When utilizing the File Service, prioritize the UUID over the filename for programmatic access. Because the service allows non-unique names, relying on filenames can lead to retrieval errors in automated workflows.

To maintain organization without a traditional folder structure, use the PARENTURI= option to logically group files under a specific object, such as a Job Execution. This ensures your outputs remain contextually linked to their source and are easily retrievable within the SAS Viya ecosystem. »