1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-03 15:40:05 +00:00

feat: new validation (ISINT) in the mp_validatecol.sas macro - https://core.sasjs.io/mp__validatecol_8sas_source.html

This commit is contained in:
munja
2021-12-24 22:02:23 +00:00
parent 51db64c90a
commit 1062a97cfe
3 changed files with 60 additions and 2 deletions

14
all.sas
View File

@@ -9892,10 +9892,13 @@ alter table &libds modify &var char(&len);
;;;;
run;
For more examples, see mp_validatecol.test.sas
Tip - when contributing, use https://regex101.com to test the regex validity!
@param [in] incol The column to be validated
@param [in] rule The rule to apply. Current rules:
@li ISINT - checks if the variable is an integer
@li ISNUM - checks if the variable is numeric
@li LIBDS - matches LIBREF.DATASET format
@li FORMAT - checks if the provided format is syntactically valid
@@ -9904,6 +9907,9 @@ alter table &libds modify &var char(&len);
<h4> SAS Macros </h4>
@li mf_getuniquename.sas
<h4> Related Macros </h4>
@li mp_validatecol.test.sas
@version 9.3
**/
@@ -9913,7 +9919,13 @@ alter table &libds modify &var char(&len);
%local tempcol;
%let tempcol=%mf_getuniquename();
%if &rule=ISNUM %then %do;
%if &rule=ISINT %then %do;
&tempcol=input(&incol,?? best32.);
&outcol=0;
if not missing(&tempcol) then if mod(&incol,1)=0 then &outcol=1;
drop &tempcol;
%end;
%else %if &rule=ISNUM %then %do;
/*
credit SØREN LASSEN
https://sasmacro.blogspot.com/2009/06/welcome-isnum-macro.html