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

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 !

1 ACCEPTED SOLUTION

Accepted Solutions
ghartge
Quartz | Level 8
Thanks...I have handed on to IT.

View solution in original post

14 REPLIES 14
Deepti44
Fluorite | Level 6

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";

 

Kurt_Bremser
Super User

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)

Deepti44
Fluorite | Level 6

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;

Kurt_Bremser
Super User

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.

Deepti44
Fluorite | Level 6

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;

Kurt_Bremser
Super User

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.

Deepti44
Fluorite | Level 6

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

 

Kurt_Bremser
Super User

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;

?

Deepti44
Fluorite | Level 6

yes i have tried noluck , but my url looks something like this starting with http

 

http://sites.suntrust.com/teams/WholesaleInfoDelivery/Portal%20Reports

 

sathya66
Barite | Level 11

Hi,

I am facing the same issue.Have you sorted this problem?

 

Thanks,

Sathya.

SASKiwi
PROC Star

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.

ghartge
Quartz | Level 8
Thanks...I have handed on to IT.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

SAS Enterprise Guide vs. SAS Studio

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 14 replies
  • 8604 views
  • 1 like
  • 5 in conversation