1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-11 06:24:35 +00:00

fix: testing fixes

This commit is contained in:
Allan Bowe
2022-05-10 21:36:16 +00:00
parent 453aee2c1f
commit 1672c96340
7 changed files with 48 additions and 27 deletions

View File

@@ -95,8 +95,9 @@ data &outds;
length reason_cd $4032 vtype $1 vnum dsid 8;
/* get column attributes */
if dsid=open("&inds","i")<1 then do;
REASON_CD="Unable to assign &inds";
dsid=open("&targetds","i");
if dsid<1 then do;
REASON_CD="Unable to assign &targetds";
putlog REASON_CD= dsid=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');
@@ -104,7 +105,7 @@ data &outds;
end;
vnum=varnum(dsid,VARIABLE_NM);
if vnum<1 then do;
REASON_CD=cats("Variable (",VARIABLE_NM,") not found in &inds");
REASON_CD=cats("Variable (",VARIABLE_NM,") not found in &targetds");
putlog REASON_CD= dsid=;
call symputx('reason_cd',reason_cd,'l');
call symputx('nobs',_n_,'l');

View File

@@ -84,6 +84,9 @@ filename &outref temp;
run;
%end;
%else %do;
proc sort data=&inds;
by SUBGROUP_ID;
run;
data _null_;
file &outref lrecl=32800;
set &inds end=last;

View File

@@ -69,7 +69,11 @@
%put %str(ERR)OR: Dataset &libds is not a dataset;
%end;
%else %do;
data &outds(rename=(&keyvar=hashkey) keep=&keyvar)/nonote2err;
data &outds(rename=(&keyvar=hashkey) keep=&keyvar)
%if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5" %then %do;
/nonote2err
%end;
;
length &prevkeyvar &keyvar $32;
retain &prevkeyvar "%sysfunc(md5(%str(&salt)),$hex32.)";
set &libds end=&lastvar;

View File

@@ -9,29 +9,32 @@
%macro mddl_dc_filterdetail(libds=WORK.FILTER_DETAIL);
%local nn lib;
%if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5" %then %do;
%let nn=not null;
%end;
%else %let nn=;
proc sql;
create table &libds(
filter_hash char(32) not null,
filter_line num not null,
group_logic char(3) not null,
subgroup_logic char(3) not null,
subgroup_id num not null,
variable_nm varchar(32) not null,
operator_nm varchar(12) not null,
raw_value varchar(4000) not null,
processed_dttm num not null format=E8601DT26.6
filter_hash char(32) &nn,
filter_line num &nn,
group_logic char(3) &nn,
subgroup_logic char(3) &nn,
subgroup_id num &nn,
variable_nm varchar(32) &nn,
operator_nm varchar(12) &nn,
raw_value varchar(4000) &nn,
processed_dttm num &nn format=E8601DT26.6
);
%local lib;
%let libds=%upcase(&libds);
%if %index(&libds,.)=0 %then %let lib=WORK;
%else %let lib=%scan(&libds,1,.);
proc datasets lib=&lib noprint;
modify %scan(&libds,-1,.);
index create
pk_mpe_filterdetail=(filter_hash filter_line)
/nomiss unique;
index create pk_mpe_filterdetail=(filter_hash filter_line)/nomiss unique;
quit;
%mend mddl_dc_filterdetail;

View File

@@ -9,22 +9,27 @@
%macro mddl_dc_filtersummary(libds=WORK.FILTER_SUMMARY);
%local nn lib;
%if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5" %then %do;
%let nn=not null;
%end;
%else %let nn=;
proc sql;
create table &libds(
filter_rk num not null,
filter_hash char(32) not null,
filter_table char(41) not null,
processed_dttm num not null format=E8601DT26.6
filter_rk num &nn,
filter_hash char(32) &nn,
filter_table char(41) &nn,
processed_dttm num &nn format=E8601DT26.6
);
%local lib;
%let libds=%upcase(&libds);
%if %index(&libds,.)=0 %then %let lib=WORK;
%else %let lib=%scan(&libds,1,.);
proc datasets lib=&lib noprint;
modify %scan(&libds,-1,.);
index create= filter_rk /nomiss unique;
index create filter_rk /nomiss unique;
quit;
%mend mddl_dc_filtersummary;

View File

@@ -9,19 +9,24 @@
%macro mddl_dc_locktable(libds=WORK.LOCKTABLE);
%local nn lib;
%if "%substr(&sysver,1,1)" ne "4" and "%substr(&sysver,1,1)" ne "5" %then %do;
%let nn=not null;
%end;
%else %let nn=;
proc sql;
create table &libds(
lock_lib char(8),
lock_ds char(32),
lock_status_cd char(10) not null,
lock_user_nm char(100) not null ,
lock_status_cd char(10) &nn,
lock_user_nm char(100) &nn ,
lock_ref char(200),
lock_pid char(10),
lock_start_dttm num format=E8601DT26.6,
lock_end_dttm num format=E8601DT26.6
);
%local lib;
%let libds=%upcase(&libds);
%if %index(&libds,.)=0 %then %let lib=WORK;
%else %let lib=%scan(&libds,1,.);

View File

@@ -174,7 +174,7 @@ run;
outds=work.badrecords,
abort=NO
)
%mp_assert(iftrue=(&syscc=42),
%mp_assert(iftrue=(&syscc=1008),
desc=Throw error if RAW_VALUE is incorrect,
outds=work.test_results
)