mirror of
https://github.com/sasjs/core.git
synced 2025-12-10 14:04:36 +00:00
fix: updating the tests following varinitchk=error enablement. Removing the word 'error' from documenttion.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_existds.sas
|
||||
|
||||
<h4> Related Macros <h4>
|
||||
@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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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!
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mf_getuniquefileref.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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user