SAS Documentation
SASĀ® Solution for Stress Testing
Reference manual - version 08.2021
Loading...
Searching...
No Matches
irmst_recombine_bep.sas
Go to the documentation of this file.
1/*
2 Copyright (C) 2019 SAS Institute Inc. Cary, NC, USA
3*/
4
5/**
6\file
7\brief The macro rsk_recombine.sas stacks the set of partitioned tables into one non-partitioned table.
8
9\details
10
11<b> Identified Inputs </b>
12
13The following inputs are required by this macro:
14 \param[in] IN_DS_NM The table name of the input partitioned datasets
15 \param[in] LIB_PREFIX The library prefix of the input libraries when appending partitioned tables
16 \param[in] PARTITON_NO Number of partitions
17
18<b> Identified Output</b>
19
20 \param[out] O_DS Output non-partitioned table
21
22\author SAS Institute INC.
23\date 2019
24
25 */
26%macro irmst_recombine_bep(IN_DS_NM = ,
27 DS_IN_BEP_SUMMARY= ,
28 DS_IN_BSP_CONFIG= ,
29 DS_IN_UN_AGG_TBLS=,
30 LIB_PREFIX = ,
31 PARTITION_NO = ,
32 TECHNIQUE = SET,
33 O_DS = );
34
35 /*strip libname from datasets*/
36 %let in_lib=%scan(&IN_DS_NM,1,'.');
37 %let out_lib=%scan(&O_DS, 1, '.');
38
39proc sql;
40 select scenario_name
41 into: scenario_names separated by ','
42 from &DS_IN_BSP_CONFIG;
43
44 create table &O_DS. as
45 select dataDefSchemaName as tbl_name,
46 "&scenario_names." as scenario_name,
47 "&out_lib." as tbl_lib
48 from &DS_IN_BEP_SUMMARY.;
49quit;
50
51proc sql;
52 select tbl_name into: tbls_names separated by ','
53 from &O_DS.;
54quit;
55
56%local i;
57data _null_;
58 do indx=1 to countw("&tbls_names",',');
59 tbl_name=scan("&tbls_names.",indx,',');
60 call symputx(cats('tbl_nm_',indx),tbl_name);
61 end;
62run;
63
64%do indx=1 %to %sysfunc(countw("&tbls_names",','));
65 /* Stack partitioned datasets into one. */
66 data temp;
67 set
68 %do i=1 %to &PARTITION_NO;
69 &LIB_PREFIX.&i..&&tbl_nm_&indx..
70 %end;;
71 run;
72 /* proc sql;
73 create table &out_lib..&&tbl_nm_&indx.. as
74 select distinct *
75 from temp;
76 quit; */
77 proc append base =&out_lib..&&tbl_nm_&indx.. data=temp;
78 run;
79%end;
80
81
82%mend;