Published on :
Macro CREATION_INTERNE

Managing Core SASjs Tables (mp_coretable)

This code is also available in: Deutsch Español Français
Awaiting validation
The `mp_coretable` macro facilitates the creation of standard table structures used by the sasjs framework (such as DIFFTABLE, LOCKTABLE, FILTER_SUMMARY, etc.). It acts as a dispatcher that calls the appropriate data definition macros (`mddl_dc_*`) based on the requested table type. It also offers a preview mode (if `libds=0`) which temporarily generates the table, displays its description in the log, then deletes it.
Data Analysis

Type : CREATION_INTERNE


Data structures are defined by internal macro calls (`%mddl_dc_*`). No external data source is read.

1 Code Block
MACRO
Explanation :
Determines the name of the output table. Uses `%mf_getuniquename()` to generate a unique temporary name if no name is provided via `libds`.
Copied!
1%let outds=%sysfunc(ifc(&libds=0,%mf_getuniquename(),&libds));
2 
2 Code Block
PROC SQL Data
Explanation :
Conditional selection and execution of the specific DDL macro (`%mddl_dc_*`) corresponding to the requested table type (`&table_ref`) to create the data structure.
Copied!
1PROC SQL;
2%IF &table_ref=DIFFTABLE %THEN %DO;
3 %mddl_dc_difftable(libds=&outds)
4%END;
5%ELSE %IF &table_ref=LOCKTABLE %THEN %DO;
6 %mddl_dc_locktable(libds=&outds)
7%END;
8/* ... autres conditions pour FILTER_SUMMARY, FILTER_DETAIL, MAXKEYTABLE ... */
3 Code Block
PROC SQL
Explanation :
Cleanup in preview mode: if the table was created in a temporary location (libds=0), its structure is described in the log and then the table is deleted.
Copied!
1%IF &libds=0 %THEN %DO;
2 PROC SQL;
3 describe TABLE &syslast;
4 drop TABLE &syslast;
5%END;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.