Without actually knowing SAS Viya Content looks to me like the Viya implementation of the SAS 9.4 Content Server.
The new filesrvc engine lets you now easily interact with the content. In the background this engine issues a REST call.
I've done some testing and it appears to me that there is a bug in how single quotes get encoded for the REST call. They basically get doubled and then the http request searches for a file with two consecutive quotes instead of a single quote.
I suggest you raise a track with SAS Tech Support so this bug gets rectified.
Tests and Findings
I've created below two files under path /Users/&sysuserid
I've run below filename statements with DEBUG=HTTP:
/* test 1 */
filename src filesrvc
folderpath="/Users/&sysuserid"
filename="sashelp.csv"
DEBUG=HTTP
;
/* Test 2 */
filename src filesrvc
folderpath="/Users/&sysuserid"
filename="sashelp's test.csv"
DEBUG=HTTP
;
For Test 1 the SAS log shows me:
For Test 2 I get:
Note how the URL encoded file name contains %27 twice. %27 is the URL encoding for a single quote.
To test that this is the issue I've then also added a file with two single quotes: sashelp''s test.csv
And now with this file existing Test 2 returned a match
@stewart_Jardine wrote:
oh wow! what a catch! very strange bug will definitely look into it and get it raised to SAS! ever so slight wave of relief coming over me that i am not quite as bad at SAS as I thought I was!
thank you!
I guess it's related to the usual challenges when it comes to "quote a quote" and then somehow in the code the "quoting quote" doesn't get removed prior to URL encoding the string.
Of course one should push for a naming convention that doesn't allow for quotes and other special characters in file names.
As per my testing the actual Proc Http call as such doesn't return an error. You only get it when you're trying to use the fileref in an infile statement. I haven't tried it but you could eventually first run some %sysfunce(fileexist(<libref>)) check to capture such cases and not just get a syntax error.
I have reached out to SAS on this one and they have confirmed that as of Viya 2023.10 it is a known bug and there is currently "no available timeline to address this particular issue"
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.