Loading...
Searching...
No Matches
mx_createwebservice.sas
Go to the documentation of this file.
1/**
2 @file mx_createwebservice.sas
3 @brief Create a web service in SAS 9, Viya or SASjs
4 @details Creates a SASJS ready Stored Process in SAS 9, a Job Execution
5 Service in SAS Viya, or a Stored Program on SASjs Server - depending on the
6 executing environment.
7
8Usage:
9
10 %* compile macros ;
11 filename mc url "https://raw.githubusercontent.com/sasjs/core/main/all.sas";
12 %inc mc;
13
14 %* write some code;
15 filename ft15f001 temp;
16 parmcards4;
17 %* fetch any data from frontend ;
18 %webout(FETCH)
19 data example1 example2;
20 set sashelp.class;
21 run;
22 %* send data back;
23 %webout(OPEN)
24 %webout(ARR,example1) * Array format, fast, suitable for large tables ;
25 %webout(OBJ,example2) * Object format, easier to work with ;
26 %webout(CLOSE)
27 ;;;;
28
29 %* create the service (including webout macro and dependencies);
30 %mx_createwebservice(path=/Public/app/common,name=appInit,replace=YES)
31
32 <h4> SAS Macros </h4>
33 @li mf_getplatform.sas
34 @li mm_createwebservice.sas
35 @li ms_createwebservice.sas
36 @li mv_createwebservice.sas
37
38 @param [in,out] path= The full folder path where the service will be created
39 @param [in,out] name= Service name. Avoid spaces.
40 @param [in] desc= The description of the service (optional)
41 @param [in] precode= Space separated list of filerefs, pointing to the code
42 that needs to be attached to the beginning of the service (optional)
43 @param [in] code= (ft15f001) Space seperated fileref(s) of the actual code to
44 be added
45 @param [in] replace= (YES) Select YES to replace any existing service in that
46 location
47 @param [in] mDebug= (0) set to 1 to show debug messages in the log
48
49 @author Allan Bowe
50
51 <h4> Related Macros </h4>
52 @li mx_createjob.sas
53
54**/
55
56%macro mx_createwebservice(path=HOME
57 ,name=initService
58 ,precode=
59 ,code=ft15f001
60 ,desc=This service was created by the mp_createwebservice macro
61 ,replace=YES
62 ,mdebug=0
63)/*/STORE SOURCE*/;
64
65%if &syscc ge 4 %then %do;
66 %put syscc=&syscc - &sysmacroname will not execute in this state;
67 %return;
68%end;
69
70%local platform; %let platform=%mf_getplatform();
71%if &platform=SASVIYA %then %do;
72 %if "&path"="HOME" %then %let path=/Users/&sysuserid/My Folder;
73 %mv_createwebservice(path=&path
74 ,name=&name
75 ,code=&code
76 ,precode=&precode
77 ,desc=&desc
78 ,replace=&replace
79 )
80%end;
81%else %if &platform=SASJS %then %do;
82 %if "&path"="HOME" %then %let path=/Users/&_sasjs_username/My Folder;
83 %ms_createwebservice(path=&path
84 ,name=&name
85 ,code=&code
86 ,precode=&precode
87 ,mdebug=&mdebug
88 )
89%end;
90%else %do;
91 %if "&path"="HOME" %then %let path=/User Folders/&_METAPERSON/My Folder;
92 %mm_createwebservice(path=&path
93 ,name=&name
94 ,code=&code
95 ,precode=&precode
96 ,desc=&desc
97 ,replace=&replace
98 )
99%end;
100
101%mend mx_createwebservice;