Get code for a segmentation tree revision

get/segmentationTrees/{segmentationTreeId}/revisions/{revisionId}/code
Internal-Use Only

Retrieves the DS2 package code, which can be used to execute the segmentation tree revision.

Request Samples

1

Response Samples

1package SegmentationTree /inline;
2 dcl package logger m_logger('App.SASSegmentationTrees');
3 dcl int _isDebugEnabled;
4 dcl package logger logr_variableTrace('App.TableServices.DS2.Runtime.TraceVariables');
5 dcl double _double_value;
6 dcl varchar(100) _string_value;
7
8 /* matrix "matrix1" */
9 dcl varchar(100) matrix_values_0[3, 5];
10
11
12 method SegmentationTree();
13 _isDebugEnabled = m_logger.islevelactive(3);
14
15 /* matrix "matrix1" */
16 matrix_values_0[1,1] = '1<-->1';
17 matrix_values_0[1,2] = '1<-->2';
18 matrix_values_0[1,3] = '1<-->3';
19 matrix_values_0[1,4] = '1<-->4';
20 matrix_values_0[1,5] = '1<-->5';
21 matrix_values_0[2,1] = '2<-->1';
22 matrix_values_0[2,2] = '2<-->2';
23 matrix_values_0[2,3] = '2<-->3';
24 matrix_values_0[2,4] = '2<-->4';
25 matrix_values_0[2,5] = '2<-->5';
26 matrix_values_0[3,1] = '3<-->1';
27 matrix_values_0[3,2] = '3<-->2';
28 matrix_values_0[3,3] = '3<-->3';
29 matrix_values_0[3,4] = '3<-->4';
30 matrix_values_0[3,5] = '3<-->5';
31
32 end;
33
34 /* boolean expression "boolean_expression_1" */
35 method boolean_expression_0(
36 in_out varchar "var_string_input_1",
37 in_out double ret_val
38 );
39 ret_val = var_string_input_1>1;
40 end;
41
42 /* boolean expression "boolean_expression_2" */
43 method boolean_expression_1(
44 in_out varchar "var_string_input_1",
45 in_out double ret_val
46 );
47 ret_val = var_string_input_1>2;
48 end;
49
50 /* boolean expression "boolean_expression_3" */
51 method boolean_expression_2(
52 in_out varchar "var_string_input_1",
53 in_out double ret_val
54 );
55 ret_val = var_string_input_1>3;
56 end;
57
58 /* boolean expression "boolean_expression_4" */
59 method boolean_expression_3(
60 in_out varchar "var_string_input_1",
61 in_out double ret_val
62 );
63 ret_val = var_string_input_1>4;
64 end;
65
66 /* boolean expression "boolean_expression_5" */
67 method boolean_expression_4(
68 in_out varchar "var_string_input_1",
69 in_out double ret_val
70 );
71 ret_val = var_string_input_1>5;
72 end;
73
74
75 /* matrix matrix1 */
76 method matrix_0(
77 in_out varchar "var_string_input_1",
78 in_out varchar "var_string_input_2",
79 in_out varchar ret_val
80 );
81 dcl double down_index;
82 dcl double across_index;
83
84 down_index = -1;
85 across_index = -1;
86 ret_val = 'others';
87
88 if(_string_value in (>'23')) then down_index = 0;
89 else if(_string_value in (>'23')) then down_index = 1;
90 else if(_string_value in (>'23')) then down_index = 2;
91
92 if(_string_value in (<'45')) then across_index = 0;
93 else if(_string_value in (<'45')) then across_index = 1;
94 else if(_string_value in (<'45')) then across_index = 2;
95 else if(_string_value in (<'45')) then across_index = 3;
96 else if(_string_value in (<'45')) then across_index = 4;
97
98 if(down_index ^= -1 and across_index ^= -1) then ret_val = matrix_values_0[down_index,across_index];
99 end;
100
101 method outcome_0(
102 in_out double "var_decimal_output_1" ,
103 in_out double "var_decimal_output_2" ,
104 in_out double "var_decimal_output_3" ,
105 in_out varchar "var_string_input_1" ,
106 in_out varchar "var_string_input_2" ,
107 in_out varchar "var_string_input_3"
108 );
109 "var_string_input_1" = 'ksk_1';
110
111 "var_string_input_2" = 'ksk_2';
112
113 "var_string_input_3" = 'ksk_3';
114
115 /* code_assigment_action_1 */
116 var_decimal_output_1 = 0;
117
118 /* code_assigment_action_2 */
119 var_decimal_output_2 = 1000;
120
121 /* code_assigment_action_3 */
122 var_decimal_output_3 = 2000;
123
124
125 end;
126
127 method execute(
128 double "var_boolean_input_1",
129 double "var_boolean_input_2",
130 double "var_boolean_input_3",
131 double "var_date_input_1",
132 double "var_date_input_2",
133 double "var_date_input_3",
134 double "var_datetime_input_1",
135 double "var_datetime_input_2",
136 double "var_datetime_input_3",
137 double "var_decimal_input_1",
138 double "var_decimal_input_2",
139 double "var_decimal_input_3",
140 double "var_integer_input_1",
141 double "var_integer_input_2",
142 double "var_integer_input_3",
143 in_out varchar "var_string_input_1",
144 in_out varchar "var_string_input_2",
145 in_out varchar "var_string_input_3",
146 in_out double "var_boolean_inOut_1",
147 in_out double "var_boolean_inOut_2",
148 in_out double "var_boolean_inOut_3",
149 in_out double "var_boolean_output_1",
150 in_out double "var_boolean_output_2",
151 in_out double "var_boolean_output_3",
152 in_out double "var_date_inOut_1",
153 in_out double "var_date_inOut_2",
154 in_out double "var_date_inOut_3",
155 in_out double "var_date_output_1",
156 in_out double "var_date_output_2",
157 in_out double "var_date_output_3",
158 in_out double "var_datetime_inOut_1",
159 in_out double "var_datetime_inOut_2",
160 in_out double "var_datetime_inOut_3",
161 in_out double "var_datetime_output_1",
162 in_out double "var_datetime_output_2",
163 in_out double "var_datetime_output_3",
164 in_out double "var_decimal_inOut_1",
165 in_out double "var_decimal_inOut_2",
166 in_out double "var_decimal_inOut_3",
167 in_out double "var_decimal_output_1",
168 in_out double "var_decimal_output_2",
169 in_out double "var_decimal_output_3",
170 in_out double "var_integer_inOut_1",
171 in_out double "var_integer_inOut_2",
172 in_out double "var_integer_inOut_3",
173 in_out double "var_integer_output_1",
174 in_out double "var_integer_output_2",
175 in_out double "var_integer_output_3",
176 in_out varchar "var_string_inOut_1",
177 in_out varchar "var_string_inOut_2",
178 in_out varchar "var_string_inOut_3",
179 in_out varchar "var_string_output_1",
180 in_out varchar "var_string_output_2",
181 in_out varchar "var_string_output_3"
182 );
183 _double_value = "var_decimal_output_1";
184 if("var_decimal_output_1" >1) then
185 /* boolean expression boolean_expression_2 */
186 boolean_expression_1(
187 "var_string_input_1",
188 _double_value
189 );
190 if(_double_value = 1) then
191 /* matrix matrix1 */
192 matrix_0(
193 "var_string_input_1",
194 "var_string_input_2",
195 _string_value
196 );
197 if(_string_value = '2<-->1') then
198 /* outcome outcome_1 */
199 outcome_0(
200 "var_decimal_output_1" ,
201 "var_decimal_output_2" ,
202 "var_decimal_output_3" ,
203 "var_string_input_1" ,
204 "var_string_input_2" ,
205 "var_string_input_3"
206 );
207 else if(_double_value = 1) then
208 /* outcome outcome_1 */
209 outcome_0(
210 "var_decimal_output_1" ,
211 "var_decimal_output_2" ,
212 "var_decimal_output_3" ,
213 "var_string_input_1" ,
214 "var_string_input_2" ,
215 "var_string_input_3"
216 );
217 else if("var_decimal_output_1" >2) then
218 /* boolean expression boolean_expression_2 */
219 boolean_expression_1(
220 "var_string_input_1",
221 _double_value
222 );
223 if(_double_value = 1) then
224 /* matrix matrix1 */
225 matrix_0(
226 "var_string_input_1",
227 "var_string_input_2",
228 _string_value
229 );
230 if(_string_value = '2<-->1') then
231 /* outcome outcome_1 */
232 outcome_0(
233 "var_decimal_output_1" ,
234 "var_decimal_output_2" ,
235 "var_decimal_output_3" ,
236 "var_string_input_1" ,
237 "var_string_input_2" ,
238 "var_string_input_3"
239 );
240 else if(_double_value = 1) then
241 /* outcome outcome_1 */
242 outcome_0(
243 "var_decimal_output_1" ,
244 "var_decimal_output_2" ,
245 "var_decimal_output_3" ,
246 "var_string_input_1" ,
247 "var_string_input_2" ,
248 "var_string_input_3"
249 );
250 else if("var_decimal_output_1" >3) then
251 /* boolean expression boolean_expression_2 */
252 boolean_expression_1(
253 "var_string_input_1",
254 _double_value
255 );
256 if(_double_value = 1) then
257 /* matrix matrix1 */
258 matrix_0(
259 "var_string_input_1",
260 "var_string_input_2",
261 _string_value
262 );
263 if(_string_value = '2<-->1') then
264 /* outcome outcome_1 */
265 outcome_0(
266 "var_decimal_output_1" ,
267 "var_decimal_output_2" ,
268 "var_decimal_output_3" ,
269 "var_string_input_1" ,
270 "var_string_input_2" ,
271 "var_string_input_3"
272 );
273 else if(_double_value = 1) then
274 /* outcome outcome_1 */
275 outcome_0(
276 "var_decimal_output_1" ,
277 "var_decimal_output_2" ,
278 "var_decimal_output_3" ,
279 "var_string_input_1" ,
280 "var_string_input_2" ,
281 "var_string_input_3"
282 );
283 end;
284
285endpackage;
286

Path Parameters

NameTypeRequiredDescription
revisionId
string
true

The identifier for the segmentation tree revision.

Examples:
"cd942f3c-60a0-4b16-9184-4cb8921fb0eb"
segmentationTreeId
string
true

The identifier for the segmentation tree.

Examples:
"094078e7-278a-4719-a704-6e5e65af29ee"

Query Parameters

NameTypeRequiredDescription
codeTarget
string
false

The type of platform or scenario in which the generated code is used. The following are code targets:

  • microAnalyticService - Use this type when the generated DS2 is going to be run on SAS Micro Analytic Service.
  • others - Use this target type in all other cases.
Allowed values:
microAnalyticServiceothers
Examples:
"microAnalyticService"

Responses

StatusMeaningDescription
200OKThe request succeeded.HeadersSchema
404Not FoundNo code for the segmentation tree revision exists at the requested path.HeadersSchema