File Management SAS VIYA

Folders Are Dead: Understanding the Flat Architecture of the SAS Viya Files Service

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
Michael

Expert Advice

Michael
Responsable de l'infrastructure Viya.

When using the filesrvc engine (as shown in your code), you are not writing to a disk path (like C:\data), but directly to the SAS Infrastructure Data Server (PostgreSQL-based). The parenturi option is critical because it creates a logical link. Without it, your file class.csv is created as an "orphan" in the system—it exists and has a UUID, but it won't appear attached to your Job Execution or Folder, making it nearly impossible for users to retrieve via the visual interface.

Think of the Files Service as an object store, not a hard drive.
This document describes how the SAS© Viya file service works. It explains how files are stored and accessed via a unique identifier (UUID). Although there is no concept of 'folders' in this service, it is possible to associate files by using the PARENTURI= option, which specifies a relative URI for an object in the SAS© Viya platform. This allows for the creation of file collections.
Data Analysis

Type : CREATION_INTERNE


The example uses internal data from the SASHELP library (sashelp.class).

1 Code Block
DATA STEP
Explanation :
This example shows how to create a file named 'class.csv' using the DATA step and store it in the SAS Viya file service. The file is attached to a specific job execution, identified by its 'parenturi'. The file content is generated from the 'sashelp.class' table, with 'name', 'sex', 'age', 'height', and 'weight' variables exported in CSV format. The FILENAME statement with FILESRVC access is used to interact with the file service.
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;
Pro Tip
Files created in the Files Service consume database storage (PostgreSQL) or internal storage, not cheap disk space. Use this service for reports, logs, and small artifacts. For massive datasets (Gigabytes/Terabytes), stick to standard CAS Libraries or external cloud storage (S3/Azure Blob).
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.

Related Documentation

Aucune documentation spécifique pour cette catégorie.