From 0885bad8596ab604a21f1554c00f29b5fb227c62 Mon Sep 17 00:00:00 2001 From: munja Date: Mon, 13 Dec 2021 01:07:54 +0000 Subject: [PATCH] fix: updating the tests following varinitchk=error enablement. Removing the word 'error' from documenttion. --- base/mf_existfeature.sas | 2 +- base/mf_getattrc.sas | 2 +- base/mf_getattrn.sas | 2 +- base/mf_mkdir.sas | 2 +- base/mf_nobs.sas | 2 +- base/mp_copyfolder.sas | 6 ++++-- base/mp_ds2fmtds.sas | 15 +++++++++++---- base/mp_ds2inserts.sas | 1 + base/mp_filtervalidate.sas | 4 ++-- base/mp_getconstraints.sas | 6 +++--- base/mp_getddl.sas | 2 +- base/mp_init.sas | 2 +- base/mp_jsonout.sas | 2 +- base/mp_lockanytable.sas | 2 +- tests/crossplatform/mp_ds2fmtds.test.sas | 4 +++- tests/viyaonly/mv_createwebservice.test.sas | 1 + viya/mv_getfoldermembers.sas | 1 + viya/mv_jobwaitfor.sas | 1 + 18 files changed, 36 insertions(+), 21 deletions(-) diff --git a/base/mf_existfeature.sas b/base/mf_existfeature.sas index 23bad62..ecca91a 100644 --- a/base/mf_existfeature.sas +++ b/base/mf_existfeature.sas @@ -5,7 +5,7 @@ Run without arguments to see a list of detectable features. Note - this list is based on known versions of SAS rather than actual feature detection, as that is tricky / impossible to do - without generating errors in most cases. + without generating errs in most cases. %put %mf_existfeature(PROCLUA); diff --git a/base/mf_getattrc.sas b/base/mf_getattrc.sas index b1c7cc1..4e0fd51 100644 --- a/base/mf_getattrc.sas +++ b/base/mf_getattrc.sas @@ -10,7 +10,7 @@ @param attr full list in [documentation]( https://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000147794.htm) @return output returns result of the attrc value supplied, or -1 and log - message if error. + message if err. @version 9.2 @author Allan Bowe diff --git a/base/mf_getattrn.sas b/base/mf_getattrn.sas index f2ca561..fdb47a7 100755 --- a/base/mf_getattrn.sas +++ b/base/mf_getattrn.sas @@ -10,7 +10,7 @@ @param attr Common values are NLOBS and NVARS, full list in [documentation]( http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000212040.htm) @return output returns result of the attrn value supplied, or -1 and log - message if error. + message if err. @version 9.2 @author Allan Bowe diff --git a/base/mf_mkdir.sas b/base/mf_mkdir.sas index 763271b..464b468 100755 --- a/base/mf_mkdir.sas +++ b/base/mf_mkdir.sas @@ -51,7 +51,7 @@ Usage: %end; /* - Now create the directory. Complain loudly of any errors. + Now create the directory. Complain loudly of any errs. */ %let dname = %sysfunc(dcreate(&child, &parent)); diff --git a/base/mf_nobs.sas b/base/mf_nobs.sas index c72660f..0bdc29b 100755 --- a/base/mf_nobs.sas +++ b/base/mf_nobs.sas @@ -12,7 +12,7 @@ @param libds library.dataset @return output returns result of the attrn value supplied, or log message - if error. + if err. @version 9.2 diff --git a/base/mp_copyfolder.sas b/base/mp_copyfolder.sas index 0800857..d52fa6b 100644 --- a/base/mp_copyfolder.sas +++ b/base/mp_copyfolder.sas @@ -55,6 +55,8 @@ /* create folders and copy content */ data _null_; set work.&tempds; + length msg $256; + call missing(msg); if _n_ = 1 then dpos+sum(length(directory),2); filepath2="&target/"!!substr(filepath,dpos); if file_or_folder='folder' then call execute('%mf_mkdir('!!filepath2!!')'); @@ -63,9 +65,9 @@ rc1=filename(fref1,filepath,'disk','recfm=n'); rc2=filename(fref2,filepath2,'disk','recfm=n'); if fcopy(fref1,fref2) ne 0 then do; - sysmsg=sysmsg(); + msg=sysmsg(); putlog "%str(ERR)OR: Unable to copy " filepath " to " filepath2; - putlog sysmg=; + putlog msg=; end; end; rc=filename(fref1); diff --git a/base/mp_ds2fmtds.sas b/base/mp_ds2fmtds.sas index 9b810a6..f5ad608 100644 --- a/base/mp_ds2fmtds.sas +++ b/base/mp_ds2fmtds.sas @@ -1,16 +1,22 @@ /** @file - @brief Converts every value in a dataset to it's formatted value + @brief Converts every value in a dataset to formatted value @details Converts every value to it's formatted value. All variables will - become character, and will be in the same order. + become character, and will be in the same order as the original dataset. + + Lengths will be adjusted according to the format lengths, where applicable. Usage: %mp_ds2fmtds(sashelp.cars,work.cars) + %mp_ds2fmtds(sashelp.vallopt,vw_vallopt) @param [in] libds The library.dataset to be converted @param [out] outds The dataset to create. +

SAS Macros

+ @li mf_existds.sas +

Related Macros

@li mp_jsonout.sas @@ -22,8 +28,9 @@ )/*/STORE SOURCE*/; /* validations */ -%if not %sysfunc(exist(&libds)) %then %do; - %put %str(WARN)ING: &libds does not exist; + +%if not %mf_existds(libds=&libds) %then %do; + %put %str(WARN)ING: &libds does not exist as either a VIEW or DATASET; %return; %end; %if %index(&libds,.)=0 %then %let libds=WORK.&libds; diff --git a/base/mp_ds2inserts.sas b/base/mp_ds2inserts.sas index 073d8b6..342ca95 100644 --- a/base/mp_ds2inserts.sas +++ b/base/mp_ds2inserts.sas @@ -116,6 +116,7 @@ data _null_; if _n_>&maxobs then stop; %end; length _____str $32767; + call missing(_____str); format _numeric_ best.; format _character_ ; %local i comma var vtype vfmt; diff --git a/base/mp_filtervalidate.sas b/base/mp_filtervalidate.sas index 7544291..3dd89a1 100644 --- a/base/mp_filtervalidate.sas +++ b/base/mp_filtervalidate.sas @@ -33,8 +33,8 @@ @param [in] targetds The target dataset against which to verify the query @param [out] abort= (YES) If YES will call mp_abort.sas on any exceptions @param [out] outds= (work.mp_filtervalidate) Output dataset containing the - error / warning message, if one exists. If this table contains any rows, - there are problems! + err / warning message, if one exists. If this table contains any rows, + there are problems!

SAS Macros

@li mf_getuniquefileref.sas diff --git a/base/mp_getconstraints.sas b/base/mp_getconstraints.sas index 57087b8..78dfcd3 100644 --- a/base/mp_getconstraints.sas +++ b/base/mp_getconstraints.sas @@ -48,17 +48,17 @@ %let vw=%mf_getuniquename(prefix=mp_getconstraints_vw_); data &vw /view=&vw; set sashelp.vcncolu; - where TABLE_CATALOG="&lib"; + where table_catalog="&lib"; /* use retain approach to reset the constraint order with each constraint */ length tmp $1000; retain tmp; drop tmp; - if tmp ne catx('|',libref,table_name,constraint_type,constraint_name) then do; + if tmp ne catx('|',table_catalog,table_name,constraint_name) then do; constraint_order=1; end; else constraint_order+1; - tmp=catx('|',libref, table_name, constraint_type,constraint_name); + tmp=catx('|',table_catalog, table_name,constraint_name); run; /* must use SQL as proc datasets does not support length changes */ diff --git a/base/mp_getddl.sas b/base/mp_getddl.sas index 5ce3277..b60f522 100644 --- a/base/mp_getddl.sas +++ b/base/mp_getddl.sas @@ -139,7 +139,7 @@ run; %let curds=%scan(&dsnlist,&x); data _null_; file &fref mod; - length nm lab $1024 typ $20; + length lab $1024 typ $20; set &colinfo (where=(upcase(memname)="&curds")) end=last; if _n_=1 then do; diff --git a/base/mp_init.sas b/base/mp_init.sas index 09cae00..65592dd 100644 --- a/base/mp_init.sas +++ b/base/mp_init.sas @@ -49,7 +49,7 @@ autocorrect /* disallow mis-spelled procedure names */ compress=CHAR /* default is none so ensure we have something! */ datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */ - errorcheck=STRICT /* catch errs in libname/filename statements */ + %str(err)orcheck=STRICT /* catch errs in libname/filename statements */ fmterr /* ensure err when a format cannot be found */ mergenoby=%str(ERR)OR /* throw err when a merge has no BY variables */ missing=. /* changing this can cause hard to detect errs */ diff --git a/base/mp_jsonout.sas b/base/mp_jsonout.sas index ca65ee8..226b536 100644 --- a/base/mp_jsonout.sas +++ b/base/mp_jsonout.sas @@ -63,7 +63,7 @@ %if &action=OPEN %then %do; options nobomfile; data _null_;file &jref encoding='utf-8'; - put '{"START_DTTM" : "' "%sysfunc(datetime(),datetime20.3)" '"'; + put '{"PROCESSED_DTTM" : "' "%sysfunc(datetime(),E8601DT26.6)" '"'; run; %end; %else %if (&action=ARR or &action=OBJ) %then %do; diff --git a/base/mp_lockanytable.sas b/base/mp_lockanytable.sas index e4dcab6..ea91ca7 100644 --- a/base/mp_lockanytable.sas +++ b/base/mp_lockanytable.sas @@ -239,7 +239,7 @@ run; %let abortme=1; %end; -/* catch errors - mp_abort must be called outside of a logic block */ +/* catch errs - mp_abort must be called outside of a logic block */ %mp_abort(iftrue=(&abortme=1), msg=%superq(msg), mac=&sysmacroname diff --git a/tests/crossplatform/mp_ds2fmtds.test.sas b/tests/crossplatform/mp_ds2fmtds.test.sas index 0d6de69..e352150 100644 --- a/tests/crossplatform/mp_ds2fmtds.test.sas +++ b/tests/crossplatform/mp_ds2fmtds.test.sas @@ -15,10 +15,12 @@ filename inc temp; data _null_; set work.test; file inc; - line=cats('%mp_ds2fmtds(sashelp.',memname,',',memname,')'); + libds=cats('sashelp.',memname); + if exist(libds) then line=cats('%mp_ds2fmtds(',libds,',',memname,')'); put line; run; +options obs=50; %inc inc; %mp_assert( diff --git a/tests/viyaonly/mv_createwebservice.test.sas b/tests/viyaonly/mv_createwebservice.test.sas index 25b7298..d23e1a6 100644 --- a/tests/viyaonly/mv_createwebservice.test.sas +++ b/tests/viyaonly/mv_createwebservice.test.sas @@ -33,6 +33,7 @@ run; %put TEST1: checking web service code; data work.test_results; length test_description $256 test_result $4 test_comments $256; + if _n_=1 then call missing (of _all_); infile compare end=eof; input; if eof then do; diff --git a/viya/mv_getfoldermembers.sas b/viya/mv_getfoldermembers.sas index df27ae1..65db7be 100644 --- a/viya/mv_getfoldermembers.sas +++ b/viya/mv_getfoldermembers.sas @@ -123,6 +123,7 @@ options noquotelenmax; libname &libref2 JSON fileref=&fname2; data &outds; length id $36 name $128 uri $64 type $32 description $256; + if _n_=1 then call missing (of _all_); set &libref2..items; run; filename &fname2 clear; diff --git a/viya/mv_jobwaitfor.sas b/viya/mv_jobwaitfor.sas index ff31f8b..b485365 100644 --- a/viya/mv_jobwaitfor.sas +++ b/viya/mv_jobwaitfor.sas @@ -168,6 +168,7 @@ run; data &outds; format _program uri $128. state $32. stateDetails $32. timestamp datetime19. jobparams $32767.; + call missing (of _all_); stop; run;