BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Patrick
Opal | Level 21

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

Patrick_0-1705030176239.png

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:

Patrick_1-1705030401158.png

 

For Test 2 I get:

Patrick_3-1705030534403.png

 

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

Patrick_4-1705030863597.png

And now with this file existing Test 2 returned a match

Patrick_5-1705031053776.png

 

 

stewart_Jardine
Obsidian | Level 7
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!
Patrick
Opal | Level 21

@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.

stewart_Jardine
Obsidian | Level 7

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"

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 18 replies
  • 1606 views
  • 17 likes
  • 6 in conversation