I tried to run below code in SAS EG
options notes source;
filename reply "http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml";
filename headout TEMP "";
proc http url="http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml"
in="testing prochttp"
headerout=headout
method='put'
out=reply
auth_negotiate
ct='text/html
charset=utf-8'
verbose;
run;
Actuall path on the server is http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml
But when I tried to execute the above code it is resolving as /sas/config9_4/compute/Lev2/SASApp/http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml. with below error
ERROR: Physical file does not exist,
/sas/config9_4/compute/Lev2/SASApp/http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml.
when resolving “/sas/config9_4/compute/Lev2/SASApp” is getting added to actuall path http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml
Can you please help me out with this !
out= is meant to be a local file where the response from the server (basically the confirmation of your put request) is saved. Don't use a URL for it.
I would like to "put" the output file directly on the sharepoint location dynamically ,would it be possible ?
"http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports/logging.xml";
The "out" will only contain the server's response, NOT any data that you provided. If you want to put that onto the server, you'd need another proc http after saving it locally.
Look at the example in http://support.sas.com/documentation/cdl/en/proc/70377/HTML/default/viewer.htm#n0vfw4ml5fwn4un1ru90x...
url= where your data is put.
in= shall be a (local) file reference for the data you want to send to the URL.
out= shall be a file reference where the server response goes. (you might want to look at it to confirm that the post or put worked)
in that case all the reports placed in "resp" needs to be mapped to the sharepoint location given in the URL (please see my code below)"http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports "
does it happen automatically or do we need to map the output location to the URL behind the scenes via sas admin.
options notes source;
filename resp '/WBIO_Shared/WLS_REPORTS/test1.xlsx';
filename headout TEMP;
filename input TEMP;
data _null_;
file input;
put "this is some sample text";
run;
proc http
url="http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports"
in=input
out=resp
headerout=headout;
/* webusername="****"*/
/* webpassword="****"*/
/* auth_negotiate;*/
run;
I hate to repeat myself, but the out= destination is used to store the server's response. This response follows the HTTP protocol and is pure text, storing it in an Excel file does not, I repeat not make sense.
The data you want to "upload" (using POST or PUT) comes from file reference in=
If you want all reports named in your xlsx file to upload, convert it to a SAS dataset and then use call execute from that dataset to create the upload codes dynamically.
Thank you , I have executed it , it says "401 unauthorized" as server response, i have individual access to the sharepoint URL: but when im executing from SAS EG i think i donot have access , is it some thing sas admin needs to set it up on the backend ?
options notes source;
filename resp '/WBIO_Shared/WLS_REPORTS/test1.txt';
filename headout TEMP;
filename input '/WBIO_Shared/WLS_REPORTS/test1.xlsx';
data _null_;
file input;
put "this is some sample text";
run;
proc http
url="http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports"
in=input
out=resp
headerout=headout
webusername="***"
webpassword="***"
auth_negotiate;
run;
Add
method="PUT"
to your proc http statement. The default method when in= is specified is POST, which expects a script on the serverside to handle the data.
So I guess you should do a PUT to copy your data to sharepoint.
Still im getting same reponse from server:
HTTP/1.1 401 Unauthorized
Content-Type: text/plain; charset=utf-8
Server: Microsoft-IIS/8.0
SPRequestGuid: 0196e09d-8842-002c-da17-bfcfdca31a32
request-id: 0196e09d-8842-002c-da17-bfcfdca31a32
X-FRAME-OPTIONS: SAMEORIGIN
SPRequestDuration: 3
SPIisLatency: 0
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 15.0.0.4535
X-Content-Type-Options: nosniff
X-MS-InvokeApp: 1; RequireReadOnly
Date: Wed, 22 Mar 2017 18:06:54 GMT
Content-Length: 16
I did some searching around (GIYF) and found this:
https://communities.sas.com/t5/Base-SAS-Programming/How-to-read-data-from-the-SharePoint/td-p/30734
There, sharepoint is used just like a simple network mount / file path.
Have you already tried simply writing a file to sharepoint, like
filename out "\\sharepoint\path\filename.dat";
data _null_;
file out;
put "this is just a test";
run;
?
yes i have tried noluck , but my url looks something like this starting with http
http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports
Then I can only recommend to contact SAS technical support.
Hi,
I am facing the same issue.Have you sorted this problem?
Thanks,
Sathya.
Try searching SAS Support notes. I found this one that may help:
http://support.sas.com/kb/42/054.html
You need to find out what security method is used on the Sharepoint site you want to write to.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.