Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_deleteconstraints.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_deleteconstraints macro
4
5 <h4> SAS Macros </h4>
6 @li mp_deleteconstraints.sas
7 @li mp_assert.sas
8
9**/
10
11data work.constraints;
12 length libref $8 table_name $32 constraint_name $32 constraint_type $12
13 column_name $32;
14 libref='WORK'; table_name='CLASST'; constraint_name='PK_CLASST';
15 constraint_type='PRIMARY'; column_name='id'; output;
16 libref='WORK'; table_name='CLASST'; constraint_name='PK_CLASST';
17 constraint_type='PRIMARY'; column_name='name'; output;
18run;
19
20%mp_deleteconstraints(inds=work.constraints,outds=work.dc_out,execute=NO)
21
22proc sql noprint;
23 select count(*) into: n_stmt from work.dc_out;
24 select count(*) into: n_drop from work.dc_out
25 where index(drop_statement,'drop constraint PK_CLASST')>0;
26quit;
27
28%mp_assert(
29 iftrue=(&n_stmt=1),
30 desc=Checking that one drop statement is produced per constraint,
31 outds=work.test_results
32)
33
34%mp_assert(
35 iftrue=(&n_drop=1),
36 desc=Checking that the drop statement names the constraint,
37 outds=work.test_results
38)