@sasjs/core 4.18.11 → 4.18.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/base/mp_getpk.sas +19 -3
  2. package/package.json +1 -1
package/base/mp_getpk.sas CHANGED
@@ -55,7 +55,8 @@
55
55
  )/*/STORE SOURCE*/;
56
56
 
57
57
 
58
- %local engine schema ds1 ds2 ds3 dsn tabs1 tabs2 sum pk4sure pkdefault finalpks;
58
+ %local engine schema ds1 ds2 ds3 dsn tabs1 tabs2 sum pk4sure pkdefault finalpks
59
+ pkfromindex;
59
60
 
60
61
  %let lib=%upcase(&lib);
61
62
  %let ds=%upcase(&ds);
@@ -70,6 +71,7 @@
70
71
  %let sum=%mf_getuniquename(prefix=getpk_sum);
71
72
  %let pk4sure=%mf_getuniquename(prefix=getpk_pk4sure);
72
73
  %let pkdefault=%mf_getuniquename(prefix=getpk_pkdefault);
74
+ %let pkfromindex=%mf_getuniquename(prefix=getpk_pkfromindex);
73
75
  %let finalpks=%mf_getuniquename(prefix=getpk_finalpks);
74
76
 
75
77
  %local dbg;
@@ -180,9 +182,23 @@ create table &ds1 as
180
182
  and a.constraint_name=b.constraint_name
181
183
  order by 1,2,3,4;
182
184
 
185
+ /* extract cols from the relevant unique INDEXES */
186
+ create table &pkfromindex as
187
+ select libname as libref
188
+ ,memname as table_name
189
+ ,indxname as constraint_name
190
+ ,indxpos as constraint_order
191
+ ,name
192
+ from dictionary.indexes
193
+ where nomiss='yes' and unique='yes' and upcase(libname)="&lib"
194
+ %if &ds ne 0 %then %do;
195
+ and upcase(memname)="&ds"
196
+ %end;
197
+ order by 1,2,3,4;
198
+
183
199
  /* create one table */
184
200
  data &finalpks;
185
- set &pkdefault &pk4sure ;
201
+ set &pkdefault &pk4sure &pkfromindex;
186
202
  pk_ind=1;
187
203
  /* if there are multiple unique constraints, take the first */
188
204
  by libref table_name constraint_name;
@@ -256,4 +272,4 @@ create table &outds as
256
272
  iftrue=(&mdebug=0)
257
273
  )
258
274
 
259
- %mend mp_getpk;
275
+ %mend mp_getpk;
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  "@sasjs/cli": "3.6.0",
37
37
  "@sasjs/core": "4.4.7"
38
38
  },
39
- "version": "4.18.11"
39
+ "version": "4.18.12"
40
40
  }