18create table work.example1(
19 TX_FROM
float format=datetime19.,
22 DD_SHORTDESC
char(256),
23 constraint pk primary key(tx_from, dd_type,dd_source),
24 constraint unq unique(tx_from, dd_type),
25 constraint nnn not
null(DD_SHORTDESC)
27%mp_getpk(work,ds=example1,outds=test1)
31 call symputx(
'test1',pk_fields);
35 iftrue=(
"&test1"=
"TX_FROM DD_TYPE DD_SOURCE"),
36 desc=mp_getpk gets regular PK values in correct order,
37 outds=work.test_results
42create table work.example2(
43 TX_FROM
float format=datetime19.,
46 DD_SHORTDESC
char(256),
47 constraint unq1 unique(tx_from, dd_type),
48 constraint unq2 unique(tx_from, dd_type, dd_source),
49 constraint nnn not null(tx_from),
50 constraint nnnn not null(dd_type)
52%mp_getpk(work,ds=example2,outds=test2)
56 call symputx('test2',pk_fields);
60 iftrue=("&test2"="TX_FROM DD_TYPE"),
61 desc=mp_getpk gets unique constraint with NOT NULL in correct order
66create table work.example3(
67 TX_FROM
float format=datetime19.,
70 DD_SHORTDESC
char(256),
71 constraint unq1 unique(tx_from, dd_type),
72 constraint unq2 unique(tx_from, dd_type, dd_source),
73 constraint nnn not null(tx_from)
75%mp_getpk(work,ds=example3,outds=test3)
79 call symputx('test3',pk_fields);
83 iftrue=("&test3 "=" "),
84 desc=mp_getpk does not capture unique constraint without NOT NULL,
85 outds=work.test_results
89%mp_getpk(work,outds=test4)
91%mp_assertdsobs(work.test4,test=ATLEAST 2)
95create table work.example5(
96 TX_FROM
float format=datetime19.,
99 DD_SHORTDESC
char(256)
101proc datasets lib=work noprint;
103 index create tx_from /nomiss unique;
105%mp_getpk(work,ds=example5,outds=test5)
108 call symputx('test5',pk_fields);
111 iftrue=("&test5"="TX_FROM"),
112 desc=mp_getpk captures single column not null unique index,
113 outds=work.test_results
118create table work.example6(
119 TX_FROM
float format=datetime19.,
121 DD_SOURCE
char(2048),
122 DD_SHORTDESC
char(256)
124proc datasets lib=work noprint;
126 index create pk_6=(tx_from dd_type) /nomiss unique;
128%mp_getpk(work,ds=example6,outds=test6)
131 call symputx('test6',pk_fields);
134 iftrue=("&test6"="TX_FROM DD_TYPE"),
135 desc=mp_getpk captures multiple column not null unique index,
136 outds=work.test_results