1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-11 11:00:04 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
Allan Bowe
b02a9e3478 Merge pull request #107 from sasjs/hashdclogic
fix: adding iftrue switch to mp_hashdataset
2021-12-08 20:59:35 +00:00
munja
3d3c76c836 fix: adding iftrue switch to mp_hashdataset 2021-12-08 20:58:59 +00:00
Allan Bowe
e039f1cd83 Merge pull request #106 from sasjs/hook
chore: adding hook script to prevent accidental commits to master
2021-12-07 17:44:00 +00:00
munja
6c8165601d chore: adding hook script to prevent accidental commits to master 2021-12-07 16:58:23 +00:00
munja
596624c1bf chore: remove the word ERROR from the code 2021-12-06 15:14:46 +00:00
munja
4aca34d4c2 fix: missing end comment in mp_init.sas 2021-12-06 14:58:13 +00:00
4 changed files with 30 additions and 11 deletions

View File

@@ -1,2 +1,11 @@
#!/bin/sh #!/bin/sh
sasjs lint sasjs lint
# Avoid commits to the master branch
BRANCH=`git rev-parse --abbrev-ref HEAD`
if [[ "$BRANCH" =~ ^(master|main|develop)$ ]]; then
echo "You are on branch $BRANCH. Are you sure you want to commit to this branch?"
echo "If so, commit with -n to bypass the pre-commit hook."
exit 1
fi

15
all.sas
View File

@@ -6169,6 +6169,7 @@ create table &outds as
@param [in] libds dataset to hash @param [in] libds dataset to hash
@param [in] salt= Provide a salt (could be, for instance, the dataset name) @param [in] salt= Provide a salt (could be, for instance, the dataset name)
@param [in] iftrue= A condition under which the macro should be executed.
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This @param [out] outds= (work.mf_hashdataset) The output dataset to create. This
will contain one column (hashkey) with one observation (a hex32. will contain one column (hashkey) with one observation (a hex32.
representation of the input hash) representation of the input hash)
@@ -6183,10 +6184,14 @@ create table &outds as
%macro mp_hashdataset( %macro mp_hashdataset(
libds, libds,
outds=, outds=,
salt= salt=,
iftrue=%str(1=1)
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%if not(%eval(%unquote(&iftrue))) %then %return;
%if %mf_getattrn(&libds,NLOBS)=0 %then %do; %if %mf_getattrn(&libds,NLOBS)=0 %then %do;
%put %str(WARN)ING: Dataset &libds is empty;, or is not a dataset; %put %str(WARN)ING: Dataset &libds is empty, or is not a dataset;
%end; %end;
%else %if %mf_getattrn(&libds,NLOBS)<0 %then %do; %else %if %mf_getattrn(&libds,NLOBS)<0 %then %do;
%put %str(ERR)OR: Dataset &libds is not a dataset; %put %str(ERR)OR: Dataset &libds is not a dataset;
@@ -6367,15 +6372,15 @@ filename &tempref clear;
compress=CHAR /* default is none so ensure we have something! */ compress=CHAR /* default is none so ensure we have something! */
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */ datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
errorcheck=STRICT /* catch errors in libname/filename statements */ errorcheck=STRICT /* catch errors in libname/filename statements */
fmterr /* ensure error when a format cannot be found */ fmterr /* ensure err when a format cannot be found */
mergenoby=ERROR /* mergenoby=%str(ERR)OR /* Throw err when a merge has no BY variables */
missing=. /* some sites change this which causes hard to detect errors */ missing=. /* some sites change this which causes hard to detect errors */
noquotelenmax /* avoid warnings for long strings */ noquotelenmax /* avoid warnings for long strings */
noreplace /* avoid overwriting permanent datasets */ noreplace /* avoid overwriting permanent datasets */
ps=max /* reduce log size slightly */ ps=max /* reduce log size slightly */
validmemname=COMPATIBLE /* avoid special characters etc in table names */ validmemname=COMPATIBLE /* avoid special characters etc in table names */
validvarname=V7 /* avoid special characters etc in variable names */ validvarname=V7 /* avoid special characters etc in variable names */
varlenchk=ERROR /* fail hard if truncation (data loss) can result */ varlenchk=%str(ERR)OR /* fail hard if truncation (data loss) can result */
; ;
%mend mp_init;/** %mend mp_init;/**

View File

@@ -21,6 +21,7 @@
@param [in] libds dataset to hash @param [in] libds dataset to hash
@param [in] salt= Provide a salt (could be, for instance, the dataset name) @param [in] salt= Provide a salt (could be, for instance, the dataset name)
@param [in] iftrue= A condition under which the macro should be executed.
@param [out] outds= (work.mf_hashdataset) The output dataset to create. This @param [out] outds= (work.mf_hashdataset) The output dataset to create. This
will contain one column (hashkey) with one observation (a hex32. will contain one column (hashkey) with one observation (a hex32.
representation of the input hash) representation of the input hash)
@@ -35,10 +36,14 @@
%macro mp_hashdataset( %macro mp_hashdataset(
libds, libds,
outds=, outds=,
salt= salt=,
iftrue=%str(1=1)
)/*/STORE SOURCE*/; )/*/STORE SOURCE*/;
%if not(%eval(%unquote(&iftrue))) %then %return;
%if %mf_getattrn(&libds,NLOBS)=0 %then %do; %if %mf_getattrn(&libds,NLOBS)=0 %then %do;
%put %str(WARN)ING: Dataset &libds is empty;, or is not a dataset; %put %str(WARN)ING: Dataset &libds is empty, or is not a dataset;
%end; %end;
%else %if %mf_getattrn(&libds,NLOBS)<0 %then %do; %else %if %mf_getattrn(&libds,NLOBS)<0 %then %do;
%put %str(ERR)OR: Dataset &libds is not a dataset; %put %str(ERR)OR: Dataset &libds is not a dataset;

View File

@@ -40,15 +40,15 @@
compress=CHAR /* default is none so ensure we have something! */ compress=CHAR /* default is none so ensure we have something! */
datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */ datastmtchk=ALLKEYWORDS /* protection from overwriting input datasets */
errorcheck=STRICT /* catch errors in libname/filename statements */ errorcheck=STRICT /* catch errors in libname/filename statements */
fmterr /* ensure error when a format cannot be found */ fmterr /* ensure err when a format cannot be found */
mergenoby=ERROR /* mergenoby=%str(ERR)OR /* Throw err when a merge has no BY variables */
missing=. /* some sites change this which causes hard to detect errors */ missing=. /* some sites change this which causes hard to detect errors */
noquotelenmax /* avoid warnings for long strings */ noquotelenmax /* avoid warnings for long strings */
noreplace /* avoid overwriting permanent datasets */ noreplace /* avoid overwriting permanent datasets */
ps=max /* reduce log size slightly */ ps=max /* reduce log size slightly */
validmemname=COMPATIBLE /* avoid special characters etc in table names */ validmemname=COMPATIBLE /* avoid special characters etc in table names */
validvarname=V7 /* avoid special characters etc in variable names */ validvarname=V7 /* avoid special characters etc in variable names */
varlenchk=ERROR /* fail hard if truncation (data loss) can result */ varlenchk=%str(ERR)OR /* fail hard if truncation (data loss) can result */
; ;
%mend mp_init; %mend mp_init;