1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 14:04:36 +00:00
Files
core/tests/base/mp_getconstraints.test.sas
munja 512f05c0b2 feat: creating new mx_ suite of macros!
also adding new mx_getcode macro
2022-05-19 22:02:19 +01:00

58 lines
1.3 KiB
SAS

/**
@file
@brief Testing mp_getconstraints.sas macro
<h4> SAS Macros </h4>
@li mf_nobs.sas
@li mp_getconstraints.sas
@li mp_assert.sas
@li mp_assertscope.sas
**/
%macro conditional();
%if %sysfunc(exist(sashelp.vcncolu,view))=1 %then %do;
proc sql;
create table work.example(
TX_FROM float format=datetime19.,
DD_TYPE char(16),
DD_SOURCE char(2048),
DD_SHORTDESC char(256),
constraint pk primary key(tx_from, dd_type,dd_source),
constraint unq unique(tx_from, dd_type),
constraint nnn not null(DD_SHORTDESC)
);
%mp_assertscope(SNAPSHOT)
%mp_getconstraints(lib=work,ds=example,outds=work.constraints)
%mp_assertscope(COMPARE)
%mp_assert(
iftrue=(%mf_nobs(work.constraints)=6),
desc=Output table work.constraints created with correct number of records,
outds=work.test_results
)
%end;
%else %do;
proc sql;
create table work.example(
TX_FROM float format=datetime19.,
DD_TYPE char(16),
DD_SOURCE char(2048),
DD_SHORTDESC char(256)
);
%mp_assertscope(SNAPSHOT)
%mp_getconstraints(lib=work,ds=example,outds=work.constraints)
%mp_assertscope(COMPARE)
%mp_assert(
iftrue=(%mf_nobs(work.constraints)=0),
desc=Empty table created as constraints not supported,
outds=work.test_results
)
%end;
%mend conditional;
%conditional()