BasePlus, version 0.9

New parameter `mcArray=` added to the `%getVars()` macro.
*Optional*, default value is blank.
1) When *null* - the macro behaves like a macro function
and returns a text string with variables list.
2) When *not null* - behaviour of the macro is altered.
In such case a macro array of selected variables, named
with `mcArray` value as a prefix, is created.
Furthermore a macro named as `mcArray` value is generated.
(see the macroArray package for the details).
When `mcArray=` parameter is active the `getVars` macro
cannot be called within the `%put` statement. Execution like:
`%put %getVars(..., mcArray=XXX);` will result with
an Explicit & Radical Refuse Of Run (aka ERROR).
This commit is contained in:
yabwon
2020-11-03 13:26:14 +01:00
parent 0bd4f69209
commit 68e1562c19
5 changed files with 51 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
- [The BasePlus package [ver. 0.8]](#baseplus-package)
- [The BasePlus package](#baseplus-package)
- [Content description](#content-description)
* [`%getVars()` macro](#getvars-macro)
* [`%QgetVars()` macro](#qgetvars-macro)
@@ -38,7 +38,7 @@
---
# The BasePlus package [ver. 0.8] <a name="baseplus-package"></a> ###############################################
# The BasePlus package [ver. 0.9] <a name="baseplus-package"></a> ###############################################
The **BasePlus** package implements useful
functions and functionalities I miss in the BASE SAS.
@@ -199,10 +199,10 @@ Package contains:
32. functions quicksorthashsddv
33. functions quicksortlight
*SAS package generated by generatePackage, version 20201018*
*SAS package generated by generatePackage, version 20201101*
The SHA256 hash digest for package BasePlus:
`9549378E5F81DA4DC421C366DF006D270261852336CE3DCD88FF8E2A759938C8`
`9AC9F71DBC890068BBD972311BEF3F0D1CA100C3F80A5C34C56B9646D04BFEFB`
---
# Content description ############################################################################################
@@ -229,7 +229,8 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,sep=>
<,pattern=>
<,varRange=>
<,quote=>
<,quote=>
<,mcArray=>
)
~~~~~~~~~~~~~~~~~~~~~~~
@@ -250,7 +251,20 @@ The basic syntax is the following, the `<...>` means optional parameters:
* `quote =` - *Optional*, default value is blank, a quotation
symbol to be used around values.
* `mcArray=` - *Optional*, default value is blank.
1) When *null* - the macro behaves like a macro function
and returns a text string with variables list.
2) When *not null* - behaviour of the macro is altered.
In such case a macro array of selected variables, named
with `mcArray` value as a prefix, is created.
Furthermore a macro named as `mcArray` value is generated.
(see the macroArray package for the details).
When `mcArray=` parameter is active the `getVars` macro
cannot be called within the `%put` statement. Execution like:
`%put %getVars(..., mcArray=XXX);` will result with
an Explicit & Radical Refuse Of Run (aka ERROR).
### EXAMPLES AND USECASES: ####################################################
**EXAMPLE 1.** A list of all variables from the
@@ -454,6 +468,30 @@ run;
%put #%getVars(class, varRange=%getVars(class, varRange=_numeric_, sep=%str(: )):, sep=\)#;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**EXAMPLE 11.** Create a macro array `XYZ...` of variables names and an additional
macro `%XYZ()` which allows easy access to the list. Can be used with
the `%do_over()` macro (provided with the macroArray package).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data test;
array x[30];
array y[30] $ ;
array z[30];
run;
%getVars(test
,mcArray=XYZ
,varRange=x10-numeric-z22 y6-y26
,pattern=(5|7)$
,quote=#)
%put _user_;
%put *%XYZ(1)**%XYZ(2)*%XYZ(3)*;
%* Load the macroArray package first. ;
%put %do_over(XYZ);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
## >>> `%QgetVars()` macro: <<< <a name="qgetvars-macro"></a> #######################