- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone.
I am trying to call a .sas program in SAS Viya from a location on the server.
I have used the filesrvc command but it doesn't work.
These are the sentences:
filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS /';
data _null_;
infile myfldr ('infile_put.sas');
run
This is the log:
NOTE: The infile library MYFLDR is: Directory = / Users / Edachiardi / CodigosSAS /, Folder Identifier = af055b98-acdc-44f8-a874-da6bdd394aa4, Last Modified = November 10, 2019 17H46 NOTE: The infile MYFLDR ('infile_put.sas') is: Filename = infile_put.sas, URI path = / files / files / 12f21451-b610-4fb7-b1ed-cbc76791a98b, File Identifier = 12f21451-b610-4fb7-b1ed-cbc76791a98b, Content Type = application / octet-stream, Parent URI = / folders / folders / af055b98-acdc-44f8-a874-da6bdd394aa4, RECFM = V, LRECL = 32767, File Size (bytes) = 135, Last Modified = November 10, 2019 18H02, Create Time = November 10, 2019 4:45 PM NOTE: A total of 0 records were read from the infile library MYFLDR. NOTE: 0 records were read from the infile MYFLDR ('infile_put.sas'). NOTE: DATA statement has used (Total process time): real time 0.52 seconds cpu time 0.17 seconds
Any ideas for correct invocation.
Thanks.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Multiple questions you need to answer.
Does the file exist? Is it not empty? Does it actually have SAS code? Or something else?
You could make a slight change to your DATA step so you could look at the first few lines of the file.
filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS /';
data _null_;
infile myfldr ('infile_put.sas') obs=5;
input;
list;
run;
If it looks like it is there and is the code you want to run then try replacing the DATA step with the %INCLUDE statement.
filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS /';
%include myfldr ('infile_put.sas') / source2;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I see no %include in your code.
In the data step, there is no input statement, so nothing is read.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi KurtBremser, thanks for your answer.
The %include statement works in SAS Guide or base, in VIYA doesn't work. The recommendation for "accessing a File by Name and Folder" in SAS VIYA is the "fileserv" instruction.
I need to include lot of sas code files into a data step but I could not.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Multiple questions you need to answer.
Does the file exist? Is it not empty? Does it actually have SAS code? Or something else?
You could make a slight change to your DATA step so you could look at the first few lines of the file.
filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS /';
data _null_;
infile myfldr ('infile_put.sas') obs=5;
input;
list;
run;
If it looks like it is there and is the code you want to run then try replacing the DATA step with the %INCLUDE statement.
filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS /';
%include myfldr ('infile_put.sas') / source2;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tom, thank you very much.
The second sentence that you send me works very good.
This is the log.
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 77 78 filename myfldr filesrvc folderPath = '/Users/Edachiardi/CodigosSAS/'; 79 data file; 80 %include myfldr ('infile_put2.sas') / source2; NOTE: %INCLUDE (level 1) file MYFLDR(infile_put2.sas) is file infile_put2.sas. 81 + input x y month $; 82 + datalines; NOTE: The data set WORK.FILE has 4 observations and 3 variables. NOTE: DATA statement ha utilizado (Tiempo de proceso total): real time 1.01 seconds cpu time 0.25 seconds 87 +; NOTE: %INCLUDE (level 1) ending. 88 run; 89 90 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 104
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
From where do you take it that %include does not work in Viya? There is nothing in the documentation that suggests it won't work in the CAS server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello again, looks this log
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 77 78 data file; 79 %include "/Users/Edachiardi/CodigosSAS/infile_put2.sas"; WARNING: Physical file does not exist, /Users/Edachiardi/CodigosSAS/infile_put2.sas. ERROR: Cannot open %INCLUDE file /Users/Edachiardi/CodigosSAS/infile_put2.sas. 80 run; NOTE: The data set WORK.FILE has 1 observations and 0 variables. NOTE: DATA statement ha utilizado (Tiempo de proceso total): real time 0.00 seconds cpu time 0.00 seconds 81 82 83 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK; 97
VIYA was installed in a server Linux