I am trying to upload a csv file from SAS to Sharefile dropbox using the below code.
When I run the below code, I get 'Physical file does not exist' error. I guess it is not able to translate/read the dropbox URL.
Has anyone done something similar before?
filename _inbox "https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX";/* Path of the Folder where we wish to upload the document */ filename class "/staff/XXX/userid/test.txt"; /* Path of the Folder where the document is present */ proc http method="post" url="https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX" webusername="email@example.com" webpassword="XXXX" in=class out=_inbox proxyhost="http://xxxx.corp.xxx.abc.nz" proxyport=8080 in=class ct="application/x-www-form-urlencoded" verbose ; run; Log snippet as below - URL = https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX Proxy Host = http://xxxx.corp.xxx.abc.nz Proxy Port = 8080 METHOD = post CT = application/x-www-form-urlencoded In = /staff/xxxx/userid/test.txt Out = /gpfs/sasfs/sasconfig/func/Lev1/DevUnit/https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX Web Auth User Name = firstname.lastname@example.org 38 run; ERROR: Physical file does not exist, /gpfs/sasfs/sasconfig/func/Lev1/DevUnit/https://XXXX.sharefile.com/f/XXXX-f9a8-41b0-8a8f-XXXX ERROR: Generic HTTP Client Error NOTE: PROCEDURE HTTP used (Total process time): real time 0.28 seconds cpu time 0.00 seconds 2 The SAS System 10:55 Wednesday, September 26, 2018 NOTE: The SAS System stopped processing this step because of errors.
The out= option has to point to a local file where the returns from the HTTP request are to be stored. The target for the post is solely in the url= option.
A filename without a specific engine always has to point to a file in the local filesystem. Protocols (http://) do not work, and since the pathname in the filename statement does not satisfy the requirements of an absolute pathname, it is considered relative and appended to the current working directory of the SAS process.
PS consult the documentation: https://documentation.sas.com/?cdcId=pgmsascdc&cdcVersion=9.4_3.3&docsetId=proc&docsetTarget=n197g47...
Aside from @Kurt_Bremser's advice, I suspect that you will not be able to upload a file with Basic Auth (the webuser/password approach). The ShareFile API, like Box or Google Drive, will require OAuth2 -- which might require that you register an "app" as a developer and then get an access token. This is needed because you'll need to grant the app the appropriate permissions to upload a file to your account. (Things have become lots more complex since the FTP days, right?)
Some services allow you to register a webhook that makes this a little simpler -- not sure if ShareFile is one of those.
It's definitely possible to do, just some more code.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.