2

I have created a SAS stored process and I need to attach it to a web service link which I intend to use it as an input in a python program .

I would really appreciate if I could get help in creating a web service from a SAS stored process .

Thank you, Nishant

jinsi
  • 123
  • 9
  • 1
    I do not agree with the vote to close. This is a common question and one that is not easily picked up by reading the SAS documentation on Stored Processes, unless directed to specific parts. – DomPazz Feb 23 '16 at 18:40

2 Answers2

1

You need to create a Stored Process in SAS Management Console, and assign it to use the Stored Process Server (not Workspace Server). Ensure it has the 'streaming output' checkbox selected.

The SAS code behind this Stored Process should then send the output (that you wish to receive from your python program) to the _webout fileref, eg:

data _null_;
  file _webout;
  put 'Hello python!';
run;

The %stpbegin and %stpend macros should NOT be used.

To reference the Stored Process just call the URL with your Stored Process name & path in the _program parameter, as follows:

http://[yourMachineName]:8080/SASStoredProcess/do?_PROGRAM=/Your/MetadataPath/YourSTPName
Allan Bowe
  • 12,306
  • 19
  • 75
  • 124
  • Thank you so much , this method worked just fine , But I wanted to ask a question in a progress to this process . - I have the web service and I want to store the data generated by the program in the SAS Stored Process which is in the web service , to store in a data frame . I would really apreciate If you give me some guidance in this process . – jinsi Feb 26 '16 at 19:49
  • I see you have asked another question for this, which was the right thing to do - http://stackoverflow.com/questions/35659982/extract-sas-stored-process-web-service-in-python-and-store-it-in-a-data-frame – Allan Bowe Feb 27 '16 at 14:21
0

Easiest is to use the SAS Stored Process Web App. It allows you to call a stored process via URL. You should read (http://support.sas.com/documentation/cdl/en/stpug/68399/HTML/default/viewer.htm#n0mbwll43n6sw3n1jhcfnx51i8ze.htm).

From there, use the Python requests library.

DomPazz
  • 12,415
  • 17
  • 23