In a previous post, I demonstrated how to trigger SAS Job Flows with file events. While other file event types exist, I focused on triggering job flows when files arrive....in SAS content.
That last bit about SAS content adds a little complexity. So, I provided two methods to produce the SAS content trigger files programmatically, one with base SAS and one with Python. However, I have heard that the file event service does not always detect the base SAS-created files. So, I'll provide a more reliable method here.
The code below is an example that you can modify for your own environment.
Special thanks to Daniel Kuiper for identifying the issue and coming up with this solution!
%let server = server.demo.sas.com;
%let folderId = @public;
%let filename = triggerFlow4.file;
%let boundary = %sysfunc(uuidgen());
/*Create Trigger file*/
filename inpFile temp;
data _null_;
file inpfile lrecl=32767 TERMSTR=CRLF;
put "--&boundary";
put 'Content-Disposition: form-data; name="file"; filename="' "&filename" '"';
put "Content-Type: text/plain";
put;
dt = put(datetime(),datetime19.);
put dt;
put "--&boundary--";
run;
/* Create a file to hold the web service response */
filename resp temp;
/* Post the trigger file to the desired SAS content folder */
proc http
url="https://&server./files/files?parentFolderUri=/folders/folders/&folderId"
oauth_bearer = sas_services
method="POST"
in=inpfile
out=resp
ct="multipart/form-data; boundary=&boundary";
headers
"Accept"="application/json";
run;
/* Write the Post response message to the log */
data _null_;
infile resp;
input;
put _infile_;
run;
Here are a few things to note:
--eebf3b6a-83c2-ce42-bf7c-69e1c70fd581
Content-Disposition: form-data; name="file"; filename="triggerFlow4.file"
Content-Type: text/plain
09JAN2026:12:03:12
--eebf3b6a-83c2-ce42-bf7c-69e1c70fd581--
This is a standard multipart REST format. The datetime will be written into the file contents.The code includes a data _null_ section at the end to write the response message from the Viya Files service. A successful execution will trigger a message like this:
{"creationTimeStamp":"2026-01-09T15:46:28.927Z","modifiedTimeStamp":"2026-01-
9T15:46:28.927Z","createdBy":"sasadm","modifiedBy":"sasadm","id":"dd0e7e12-ee56-
47ac-9066-60db62265cbc","properties":{},"contentType":"text/plain","encoding":"UTF-
8","links":[{"method":"GET","rel":"self","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","type":"application/vnd.sas.file"},
{"method":"GET","rel":"alternate","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","type":"application/vnd.sas.summary"},
{"method":"PATCH","rel":"patch","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","type":"application/vnd.sas.file","responseType":"application/vnd.sas.file
"},{"method":"PUT","rel":"update","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","type":"application/vnd.sas.file","responseType":"application/vnd.sas.file
"},{"method":"DELETE","rel":"delete","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc","uri":"/files/files/dd0e7e12-ee56-47ac-9066-60db62265cbc"},
{"method":"GET","rel":"content","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/cont
ent","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/content","type":"text/plain"},
{"method":"PUT","rel":"updateContent","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/content","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/content","type":"*/*","responseType":"application/vnd.sas.file"},
{"method":"POST","rel":"copyFile","href":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/copy","uri":"/files/files/dd0e7e12-ee56-47ac-9066-
60db62265cbc/copy","responseType":"application/vnd.sas.file"},
{"method":"POST","rel":"create","href":"/files/files","uri":"/files/files","type":"*/*","respons
eType":"application/vnd.sas.file"}],"name":"triggerFlow4.file","size":18,"searchable":true,"f
ileStatus":"unlocked","fileVersion":0,"typeDefName":"file","version":4,"virusDetected":fals
e,"urlDetected":false,"quarantine":false}
Find more articles from SAS Global Enablement and Learning here.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.