SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_weight_mip_results.sas
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 SAS Institute Inc. Cary, NC, USA
3*/
4
5/**
6 \file
7 \anchor irmst_weight_mip_results.sas
8
9 \brief irmst_weight_mip_results performs scenario weighting on the MIP model results.
10
11 \param [in] in_mip_result_ds Specifies the MIP model results table.
12 \param [in] class_vars Specifies additional class vars for scenario weighting.
13 \param [in] output_vars Specifies output variables for scenario weighting.
14 \param [in] weight_vars Specifies weight variables for scenario weighting.
15 \param [in] scenario_vars Used to define the scenario name and id in output dataset.
16 \param [out] outds Specifies the output table for the weighted MIP results.
17
18 \author SAS Institute Inc.
19 \date 2021
20*/
21
22%macro irmst_weight_mip_results(
23 outds = ,
24 in_mip_result_ds = ,
25 class_vars = ,
26 output_vars = ,
27 weight_vars = ,
28 scenario_vars =
29 );
30
31 /* Perform scenario weighting */
32 proc hpsummary data = &in_mip_result_ds missing;
33 class base_dt horizon forecast_time forecast_period &class_vars instid;
34 var &output_vars;
35 weight &weight_vars;
36 output
37 out = _tmp_model_result_weighted_ (drop = _type_ _freq_)
38 mean =
39 ;
40 run;
41
42 data &outds;
43 set
44 &in_mip_result_ds
45 _tmp_model_result_weighted_ (in = __weighted__)
46 ;
47
48 if __weighted__ then do;
49 mrsName = "Weighted";
50 scenario_name = catx(" - " &scenario_vars, mrsName);
51 scenario_id = catx("_" &scenario_vars, mrsName, cats("FT", sum(forecastTime, 0)));
52 if horizon ne 0 then output;
53 end;
54 else output;
55 run;
56
57%mend irmst_weight_mip_results;