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.
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!
filename jobout filesrvc
parenturi='/jobExecution/jobs/5a308aa7-1c3a-4465-a14c-fd69a9091926';
data _null_;
set sashelp.class;
file jobout('class.csv');
put name "," sex "," age "," height "," weight;
run;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.