SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_fltr_src_agg_tbl.sas
1%macro irmst_fltr_src_agg_tbl(scenario_name =
2 , ds_in_source_key =
3 , ds_in_agg_rules_config =
4 , ds_out_filtered =
5 );
6
7 %local
8 where_stmt
9 keep_stmt
10 ;
11
12 %let where_stmt = scenario_name eq "&scenario_name.";
13 %let keep_stmt = keep forecast_time scenario_id;
14
15 /* Get a list of variables used as source columns */
16 proc sql;
17 select distinct src_col
18 into :src_var_cols separated by ' '
19 from &ds_in_agg_rules_config.;
20 quit;
21
22 /* Get a list of variables used in the where conditions */
23 %let src_keep_var=;
24 %irm_get_vars_where_cond(ds_in = &ds_in_agg_rules_config.
25 , where_vars_col = src_where_vars
26 , var_list = src_keep_var
27 );
28 %let keep_stmt = &keep_stmt. &src_var_cols. &src_keep_var.;
29
30 /* Retrieve the credit risk detail results using the where statement and keep statement */
31 %if(%sysevalf(%superq(ds_in_source_key) ne, boolean)) %then %do;
32 %let httpSuccess = 0;
33 %let responseStatus =;
34 %irm_rgf_retrieve_analysis_data(key = &ds_in_source_key.
35 , where_clause = &where_stmt.
36 , custom_code = &keep_stmt.
37 , libref = rqsst
38 , outds =unenriched_src_tbl
39 , outds_partition_list = partition_list
40 , host = &rgf_protocol.://&rgf_host.
41 , server = &rgf_service.
42 , solution = &rgf_solution.
43 , port = &rgf_port.
44 , tgt_ticket = &tgt_ticket.
45 , outVarTicket = ticket
46 , outSuccess = httpSuccess
47 , outResponseStatus = responseStatus
48 , restartLUA = Y
49 , clearCache = Y
50 );
51 %end;
52proc sql;
53 select count(a.src_col), a.src_col, cats(trim(a.src_col)||'_w')
54 into: n_src_weight_cols ,: src_cols separated by ' ' ,: src_weight_cols separated by ' '
55 from(select distinct src_col, weight_var from &ds_in_agg_rules_config. where weight_var not =" ") as a;
56quit;
57
58data &ds_out_filtered.;
59 set unenriched_src_tbl ;
60 %do j=1 %to &n_src_weight_cols.;
61 %sysfunc(cats(%scan("&src_weight_cols.",-&j.," "),&j.)) = %scan("&src_cols.",&j.," ");
62 %end;
63run;
64%mend;