mirror of
https://github.com/SASPAC/baseplus.git
synced 2025-12-11 06:44:35 +00:00
The BasePlus package [ver. 1.30.0]
The BasePlus package [ver. 1.30.0] - new macro `%repList()` added - doc. updated SHA256 digest: `F*B91771D45C781B6806DBB44A3B491A0784D7698B9F3BBBE1A86EE5594834315F`
This commit is contained in:
@@ -48,7 +48,7 @@ libname NEW "%workPath()/new";
|
|||||||
```
|
```
|
||||||
and more.
|
and more.
|
||||||
|
|
||||||
SHA256 digest for the latest version of `BasePlus`: F*2FE68DD9B3692B9D46EF85B82F63C7E65010BF9E89D670FD1779F4670FA03F31
|
SHA256 digest for the latest version of `BasePlus`: F*B91771D45C781B6806DBB44A3B491A0784D7698B9F3BBBE1A86EE5594834315F
|
||||||
|
|
||||||
[**Documentation for BasePlus**](./baseplus.md "Documentation for BasePlus")
|
[**Documentation for BasePlus**](./baseplus.md "Documentation for BasePlus")
|
||||||
|
|
||||||
|
|||||||
152
baseplus.md
152
baseplus.md
@@ -52,6 +52,7 @@
|
|||||||
* [`%bpPIPE()` macro](#bppipe-macro)
|
* [`%bpPIPE()` macro](#bppipe-macro)
|
||||||
* [`%dirsAndFiles()` macro](#dirsandfiles-macro)
|
* [`%dirsAndFiles()` macro](#dirsandfiles-macro)
|
||||||
* [`%repeatTxt()` macro](#repeattxt-macro)
|
* [`%repeatTxt()` macro](#repeattxt-macro)
|
||||||
|
* [`%repList()` macro](#replist-macro)
|
||||||
* [`%intsList()` macro](#intslist-macro)
|
* [`%intsList()` macro](#intslist-macro)
|
||||||
* [`%letters()` macro](#letters-macro)
|
* [`%letters()` macro](#letters-macro)
|
||||||
* [`%splitDSIntoBlocks()` macro](#splitdsintoblocks-macro)
|
* [`%splitDSIntoBlocks()` macro](#splitdsintoblocks-macro)
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# The BasePlus package [ver. 1.29.1] <a name="baseplus-package"></a> ###############################################
|
# The BasePlus package [ver. 1.30.0] <a name="baseplus-package"></a> ###############################################
|
||||||
|
|
||||||
The **BasePlus** package implements useful
|
The **BasePlus** package implements useful
|
||||||
functions and functionalities I miss in the BASE SAS.
|
functions and functionalities I miss in the BASE SAS.
|
||||||
@@ -309,6 +310,33 @@ run;
|
|||||||
run;
|
run;
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
**EXAMPLE 22** Repeating texts and lists:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
options mprint;
|
||||||
|
|
||||||
|
data work.A;
|
||||||
|
x=17;
|
||||||
|
data work.B;
|
||||||
|
x=42;
|
||||||
|
data work.C;
|
||||||
|
x=303;
|
||||||
|
run;
|
||||||
|
|
||||||
|
data work.test5;
|
||||||
|
set
|
||||||
|
%repeatTxt(work.A work.B work.C, 5)
|
||||||
|
;
|
||||||
|
run;
|
||||||
|
|
||||||
|
|
||||||
|
data Times2_A3B4C5;
|
||||||
|
set
|
||||||
|
%repList(work.A work.B work.C, times = 2, each = 3 4 5)
|
||||||
|
;
|
||||||
|
run;
|
||||||
|
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Package contains:
|
Package contains:
|
||||||
@@ -375,9 +403,11 @@ Package contains:
|
|||||||
61. macro letters
|
61. macro letters
|
||||||
62. macro libpath
|
62. macro libpath
|
||||||
63. macro minclude
|
63. macro minclude
|
||||||
64. macro translate
|
64. macro replist
|
||||||
65. macro tranwrd
|
65. macro translate
|
||||||
66. macro workpath
|
66. macro tranwrd
|
||||||
|
67. macro workpath
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -388,7 +418,7 @@ localization (only if additional content was deployed during the installation pr
|
|||||||
* SAS package generated by generatePackage, version 20230905 *
|
* SAS package generated by generatePackage, version 20230905 *
|
||||||
|
|
||||||
The SHA256 hash digest for package BasePlus:
|
The SHA256 hash digest for package BasePlus:
|
||||||
`F*2FE68DD9B3692B9D46EF85B82F63C7E65010BF9E89D670FD1779F4670FA03F31`
|
`F*B91771D45C781B6806DBB44A3B491A0784D7698B9F3BBBE1A86EE5594834315F`
|
||||||
|
|
||||||
---
|
---
|
||||||
# Content description ############################################################################################
|
# Content description ############################################################################################
|
||||||
@@ -4399,6 +4429,118 @@ run;
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## >>> `%repList()` macro: <<< <a name="replist-macro"></a> #######################
|
||||||
|
|
||||||
|
The repList() macro function allows to repeat `T`
|
||||||
|
times elements of a `L` list, possibly `E` times each element,
|
||||||
|
separated by string `S`.
|
||||||
|
|
||||||
|
See examples below for the details.
|
||||||
|
|
||||||
|
The `%repList()` macro executes like a pure macro code.
|
||||||
|
|
||||||
|
### SYNTAX: ###################################################################
|
||||||
|
|
||||||
|
The basic syntax is the following, the `<...>` means optional parameters:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%repList(
|
||||||
|
list
|
||||||
|
<,times=>
|
||||||
|
<,each=>
|
||||||
|
<,lenghtOut=>
|
||||||
|
<,sep=>
|
||||||
|
)
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
**Arguments description**:
|
||||||
|
|
||||||
|
1. `list` - *Required*, a list of elements to be repeated.
|
||||||
|
List can be space or comma separated.
|
||||||
|
Elements can be in quotes.
|
||||||
|
For comma separated list add brackets
|
||||||
|
e.g., `%repList((A,B,C,D),times=5)`.
|
||||||
|
The list separators are: `<{[( ,;)]}>`.
|
||||||
|
|
||||||
|
* `times=` - *Optional*, An integer indicating
|
||||||
|
the number of repetitions.
|
||||||
|
By default set to `1`.
|
||||||
|
|
||||||
|
|
||||||
|
* `each=` - *Optional*, A list of integers indicating
|
||||||
|
the number of repetitions of each element of the list
|
||||||
|
e.g., for a list `A B C` and the `each=2 4` the result
|
||||||
|
is `A A B B B B C C`. If the number of integers is less
|
||||||
|
then the length of the list values are recycled from
|
||||||
|
the beginning.
|
||||||
|
By default set to `1`.
|
||||||
|
|
||||||
|
* `lenghtOut=` - *Optional*, An integer indicating
|
||||||
|
after what the number of repetitions process will stop.
|
||||||
|
By default set to `0` which means "do not stop".
|
||||||
|
|
||||||
|
* `sep=` - *Optional*, it is a separator printed between
|
||||||
|
repeated elements. Mnemonics for *space* is `s`,
|
||||||
|
for *comma* is `c`, and for semicolon in `q`.
|
||||||
|
Default value is a single space.
|
||||||
|
|
||||||
|
|
||||||
|
### EXAMPLES AND USECASES: ####################################################
|
||||||
|
|
||||||
|
**EXAMPLE 1.** Simple repetition of all elements:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put %repList((A,B,C,D), times=3);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
**EXAMPLE 2.** Simple repetition of each element:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put %repList(("A",'B',"C",'D'), each=3);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
**EXAMPLE 3.** Simple repetition with a separator:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put %repList(A10;B20;C30, times=3, each=2, sep=Q);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
**EXAMPLE 4.** Recycle elements up to 8 with a comma as a separator:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put %repList(1 2 3, lenghtOut=8, sep=c);
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
**EXAMPLE 5.** Separate number of repetitions for each element:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put [%repList([D][C][B][A], each = 2 3 5 7, sep=] [)];
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
**EXAMPLE 6.** "ASCII art" butterflies:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
%put {>%repList(! $ |, times = 2, each =2 1, sep=<} ... {>)<};
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
**EXAMPLE 7.** Data repeating:
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
|
data A;
|
||||||
|
x=17;
|
||||||
|
data B;
|
||||||
|
x=42;
|
||||||
|
data C;
|
||||||
|
x=303;
|
||||||
|
run;
|
||||||
|
|
||||||
|
data Times2_A10B11C12;
|
||||||
|
set
|
||||||
|
%repList(A B C, times = 2, each =10 11 12)
|
||||||
|
;
|
||||||
|
run;
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
## >>> `%intsList()` macro: <<< <a name="intslist-macro"></a> #######################
|
## >>> `%intsList()` macro: <<< <a name="intslist-macro"></a> #######################
|
||||||
|
|
||||||
The intsList() macro function allows to print a list of
|
The intsList() macro function allows to print a list of
|
||||||
|
|||||||
BIN
baseplus.zip
BIN
baseplus.zip
Binary file not shown.
5640
hist/1.30.0/baseplus.md
Normal file
5640
hist/1.30.0/baseplus.md
Normal file
File diff suppressed because it is too large
Load Diff
BIN
hist/1.30.0/baseplus.zip
Normal file
BIN
hist/1.30.0/baseplus.zip
Normal file
Binary file not shown.
Reference in New Issue
Block a user