mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-10 16:30:06 +00:00
37
README.md
37
README.md
@@ -1,5 +1,7 @@
|
||||
# SAS_PACKAGES - a SAS Packages Framework and Repository
|
||||
|
||||
---
|
||||
|
||||
## Intro:
|
||||
|
||||
A **SAS package** is an automatically generated, single, stand alone *zip* file containing organised and ordered code structures, created by the developer and extended with additional automatically generated "driving" files (i.e. description, metadata, load, unload, and help files).
|
||||
@@ -18,6 +20,8 @@ Short description of the SAS Packages Framework macros can be found [here](https
|
||||
- [SAS Global Forum 2020 V.E.](https://www.youtube.com/watch?v=qCkb-bx0Dv8&t=0s "SGF2020") (April 2020)
|
||||
- [Sasensei International Dojo](https://www.youtube.com/watch?v=BFhdUBQgjYQ&t=0s "SID no. 1") (April 2020)
|
||||
- [SAS dla Administratorów i Praktyków 2020](https://www.youtube.com/watch?v=mXuep2k48Z8&feature=youtu.be&t=0s "SASAiP2020") (October 2020, in Polish)
|
||||
- [Boston Area SAS Users Group webinar](https://us02web.zoom.us/rec/share/p6ZpCsvc5YZDQGpLOOLOB4zyNGA4vjfjJcNhwaGQ7jKKR00Z_bmeCcBkcwkut6Pr.Q6UoueYAOcv6dPQf "BASUG") (November 2020)
|
||||
---
|
||||
|
||||
### The User:
|
||||
To use a package:
|
||||
@@ -51,20 +55,32 @@ filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main
|
||||
```
|
||||
|
||||
[**Workshop video for the User**](https://youtu.be/qX_-HJ76g8Y)\[May 6th, 2020\] [a bit outdated but gives the idea how it works]
|
||||
|
||||
|
||||
---
|
||||
|
||||
### The Developer:
|
||||
To create your own package:
|
||||
- Read the [**`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") to learn more details.
|
||||
- Download and use the `SPFinit.sas` file (the SAS Packages Framework), the part of the framework required for *testing* is there too.
|
||||
|
||||
---
|
||||
|
||||
#### If you have any questions, suggestions, or ideas do not hesitate to contact me!
|
||||
|
||||
**Update**\[June 3rd, 2020\]**:** `%installPackage()` **macro is available**. The `%installPackage()` macro is embedded in the `loadpackage.sas` part of the framework.
|
||||
|
||||
**Update**\[June 10th, 2020\]**:** To see help info about framework macros and their parameters just run: `%generatePackage()`, `%installPackage()`, `%helpPackage()`, `%loadPackage()`, and `%unloadPackage()` with empty parameter list.
|
||||
|
||||
---
|
||||
|
||||
**Update**\[October 15th, 2020\]**:** `%previewPackage()` **macro is available**.
|
||||
|
||||
**Update**\[September 11th, 2020\]**:** ` %loadPackageS()` and `%verifyPackage()` **macros are available**.
|
||||
|
||||
**Update**\[July 30th, 2020\]**:** All components of SAS Packages Framework are now in one file `SPFinit.sas` (located in the `./SPF` directory). Documentation moved to `./SPF/Documentation` directory. Packages zip files moved to `./packages` directory.
|
||||
|
||||
**Update**\[June 10th, 2020\]**:** To see help info about framework macros and their parameters just run: `%generatePackage()`, `%installPackage()`, `%helpPackage()`, `%loadPackage()`, and `%unloadPackage()` with empty parameter list.
|
||||
|
||||
**Update**\[June 3rd, 2020\]**:** `%installPackage()` **macro is available**. The `%installPackage()` macro is embedded in the `loadpackage.sas` part of the framework.
|
||||
|
||||
---
|
||||
|
||||
## Where the SAS Packages Framework is used:
|
||||
This is a list of locations where the SAS Packages Framework is used. If you want to share that you are using SPF let me know and I'll update the list.
|
||||
|
||||
@@ -73,6 +89,8 @@ The List:
|
||||
- Poland
|
||||
- Warsaw
|
||||
|
||||
---
|
||||
|
||||
## Available packages:
|
||||
Currently the following packages are available (see the `./packages` directory):
|
||||
|
||||
@@ -92,10 +110,11 @@ SHA256 digest for MacroCore: A23C29529F3CE7D0C8BEE9545C5D22D5B5594907547374A5135
|
||||
|
||||
[Documentation for MacroCore](https://core.sasjs.io "Documentation for MacroCore")
|
||||
|
||||
- **DFA** (Dynamic Function Arrays)\[0.2\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
- **DFA** (Dynamic Function Arrays)\[0.3\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
|
||||
SHA256 digest for DFA: C795736F55B3C6EFBEF2E82362694EB017D37C54E6AEC3EB0F6F813F69F54B5F
|
||||
SHA256 digest for DFA: 1FC8D030D576C33F1B5DEB27E17534946209BC148D57A1357CA025ED1E69AEB8
|
||||
|
||||
[Documentation for DFA](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/dfa.md "Documentation for DFA")
|
||||
|
||||
- **macroArray**\[0.7\], implementation of an array concept in a macrolanguage, e.g.
|
||||
```
|
||||
@@ -121,7 +140,7 @@ SHA256 digest for macroArray: 0F1B985E2FC34C91D2A3BD237DC294502A76913B71266D7670
|
||||
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
|
||||
|
||||
|
||||
- **BasePlus**\[0.9\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
- **BasePlus**\[0.99\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
```
|
||||
call arrMissToRight(myArray);
|
||||
call arrFillMiss(17, myArray);
|
||||
@@ -135,7 +154,7 @@ format x bool.;
|
||||
|
||||
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||
```
|
||||
SHA256 digest for BasePlus: B25A3992B6FCD13528BEE462B3ADD0F5A6D15E607A6DABAA984CA66B0AD69415
|
||||
SHA256 digest for BasePlus: 7933E6BCFDCA7C04EAAC537773574799759007A5D2AED639E86CF4EA631F1351
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ SHA256 digest for MacroCore: A23C29529F3CE7D0C8BEE9545C5D22D5B5594907547374A5135
|
||||
|
||||
---
|
||||
|
||||
- **DFA** (Dynamic Function Arrays)\[0.2\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
- **DFA** (Dynamic Function Arrays)\[0.3\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
```
|
||||
%createDFArray(ArrDynamic, resizefactor=17);
|
||||
|
||||
@@ -59,7 +59,9 @@ data _null_;
|
||||
end;
|
||||
run;
|
||||
```
|
||||
SHA256 digest for DFA: C795736F55B3C6EFBEF2E82362694EB017D37C54E6AEC3EB0F6F813F69F54B5F
|
||||
SHA256 digest for DFA: 1FC8D030D576C33F1B5DEB27E17534946209BC148D57A1357CA025ED1E69AEB8
|
||||
|
||||
[Documentation for DFA](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/dfa.md "Documentation for DFA")
|
||||
|
||||
---
|
||||
|
||||
@@ -88,7 +90,7 @@ SHA256 digest for macroArray: 0F1B985E2FC34C91D2A3BD237DC294502A76913B71266D7670
|
||||
|
||||
---
|
||||
|
||||
- **BasePlus**\[0.9\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
- **BasePlus**\[0.99\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
```
|
||||
call arrMissToRight(myArray);
|
||||
call arrFillMiss(17, myArray);
|
||||
@@ -102,7 +104,7 @@ format x bool.;
|
||||
|
||||
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||
```
|
||||
SHA256 digest for BasePlus: B25A3992B6FCD13528BEE462B3ADD0F5A6D15E607A6DABAA984CA66B0AD69415
|
||||
SHA256 digest for BasePlus: 7933E6BCFDCA7C04EAAC537773574799759007A5D2AED639E86CF4EA631F1351
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/* 20201202 */
|
||||
BasePlus: 7933E6BCFDCA7C04EAAC537773574799759007A5D2AED639E86CF4EA631F1351
|
||||
|
||||
/* 20201130 */
|
||||
DFA: 1FC8D030D576C33F1B5DEB27E17534946209BC148D57A1357CA025ED1E69AEB8
|
||||
|
||||
/* 20201115 */
|
||||
BasePlus: B25A3992B6FCD13528BEE462B3ADD0F5A6D15E607A6DABAA984CA66B0AD69415
|
||||
DFA: C795736F55B3C6EFBEF2E82362694EB017D37C54E6AEC3EB0F6F813F69F54B5F
|
||||
|
||||
@@ -33,12 +33,20 @@
|
||||
* [`%dedupListP()` macro](#deduplistp-macro)
|
||||
* [`%dedupListX()` macro](#deduplistx-macro)
|
||||
* [`%QdedupListX()` macro](#qdeduplistx-macro)
|
||||
|
||||
* [`brackets.` format](#brackets-format)
|
||||
* [`semicolon.` format](#semicolon-format)
|
||||
* [`bracketsC()` function](#bracketsc-function)
|
||||
* [`bracketsN()` function](#bracketsn-function)
|
||||
* [`semicolonC()` function](#semicolonc-function)
|
||||
* [`semicolonN()` function](#semicolonn-function)
|
||||
* [`%zipEvalf()` macro](#zipevalf-macro)
|
||||
* [`%QzipEvalf()` macro](#qzipevalf-macro)
|
||||
|
||||
* [License](#license)
|
||||
|
||||
---
|
||||
|
||||
# The BasePlus package [ver. 0.9] <a name="baseplus-package"></a> ###############################################
|
||||
# The BasePlus package [ver. 0.99] <a name="baseplus-package"></a> ###############################################
|
||||
|
||||
The **BasePlus** package implements useful
|
||||
functions and functionalities I miss in the BASE SAS.
|
||||
@@ -162,47 +170,61 @@ Kudos to all who inspired me to generate this package:
|
||||
%put *%dedupListS(&list.)*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Example 8**: Zip elements of two space separated list.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let x = %zipEvalf(1 2 3 4 5 6, 2018 2019 2020, argMd=5, function=MDY, format=date11.);
|
||||
%put &=x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
Package contains:
|
||||
1. macro deduplistc
|
||||
2. macro deduplistp
|
||||
3. macro deduplists
|
||||
4. macro deduplistx
|
||||
5. macro getvars
|
||||
6. macro qdeduplistx
|
||||
7. macro qgetvars
|
||||
8. macro symdelglobal
|
||||
9. format bool
|
||||
10. format boolz
|
||||
11. format ceil
|
||||
12. format floor
|
||||
13. format int
|
||||
14. functions arrfill
|
||||
15. functions arrfillc
|
||||
16. functions arrmissfill
|
||||
17. functions arrmissfillc
|
||||
18. functions arrmisstoleft
|
||||
19. functions arrmisstoleftc
|
||||
20. functions arrmisstoright
|
||||
21. functions arrmisstorightc
|
||||
22. functions catxfc
|
||||
23. functions catxfi
|
||||
24. functions catxfj
|
||||
25. functions catxfn
|
||||
26. functions deldataset
|
||||
27. proto qsortincbyprocproto
|
||||
28. functions frommissingtonumberbs
|
||||
29. functions fromnumbertomissing
|
||||
30. functions quicksort4notmiss
|
||||
31. functions quicksorthash
|
||||
32. functions quicksorthashsddv
|
||||
33. functions quicksortlight
|
||||
1. macro deduplistc
|
||||
2. macro deduplistp
|
||||
3. macro deduplists
|
||||
4. macro deduplistx
|
||||
5. macro getvars
|
||||
6. macro qdeduplistx
|
||||
7. macro qgetvars
|
||||
8. macro qzipevalf
|
||||
9. macro symdelglobal
|
||||
10. macro zipevalf
|
||||
11. format bool
|
||||
12. format boolz
|
||||
13. format ceil
|
||||
14. format floor
|
||||
15. format int
|
||||
16. functions arrfill
|
||||
17. functions arrfillc
|
||||
18. functions arrmissfill
|
||||
19. functions arrmissfillc
|
||||
20. functions arrmisstoleft
|
||||
21. functions arrmisstoleftc
|
||||
22. functions arrmisstoright
|
||||
23. functions arrmisstorightc
|
||||
24. functions bracketsc
|
||||
25. functions bracketsn
|
||||
26. functions catxfc
|
||||
27. functions catxfi
|
||||
28. functions catxfj
|
||||
29. functions catxfn
|
||||
30. functions deldataset
|
||||
31. functions semicolonc
|
||||
32. functions semicolonn
|
||||
33. format brackets
|
||||
34. format semicolon
|
||||
35. proto qsortincbyprocproto
|
||||
36. functions frommissingtonumberbs
|
||||
37. functions fromnumbertomissing
|
||||
38. functions quicksort4notmiss
|
||||
39. functions quicksorthash
|
||||
40. functions quicksorthashsddv
|
||||
41. functions quicksortlight
|
||||
|
||||
*SAS package generated by generatePackage, version 20201115*
|
||||
|
||||
The SHA256 hash digest for package BasePlus:
|
||||
`B25A3992B6FCD13528BEE462B3ADD0F5A6D15E607A6DABAA984CA66B0AD69415`
|
||||
`7933E6BCFDCA7C04EAAC537773574799759007A5D2AED639E86CF4EA631F1351`
|
||||
|
||||
---
|
||||
# Content description ############################################################################################
|
||||
@@ -2491,6 +2513,425 @@ XlistXofXxXseparatedXvalues
|
||||
|
||||
---
|
||||
|
||||
## >>> `brackets.` format: <<< <a name="brackets-format"></a> #######################
|
||||
|
||||
The **brackets** format adds brackets around a text or a number.
|
||||
Leading and trailing spaces are dropped before adding brackets.
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**Example 1.**
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data _null_;
|
||||
input x;
|
||||
if x < 0 then put x= brackets.;
|
||||
else put x= best32.;
|
||||
cards;
|
||||
2
|
||||
1
|
||||
0
|
||||
-1
|
||||
-2
|
||||
;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `semicolon.` format: <<< <a name="semicolon-format"></a> #######################
|
||||
|
||||
The **semicolon** format adds semicolon after text or number.
|
||||
Leading and trailing spaces are dropped before adding semicolon.
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**Example 1.**
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data _null_;
|
||||
x = 1;
|
||||
y = "A";
|
||||
put x= semicolon. y= $semicolon.;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `bracketsC()` function: <<< <a name="bracketsc-function"></a> #######################
|
||||
|
||||
The **bracketsC()** function is internal function used by the *brackets* format.
|
||||
Returns character value of length 32767.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
bracketsC(X)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `X` - Character value.
|
||||
|
||||
---
|
||||
|
||||
## >>> `bracketsN()` function: <<< <a name="bracketsn-function"></a> #######################
|
||||
|
||||
The **bracketsN()** function is internal function used by the *brackets* format.
|
||||
Returns character value of length 34.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
bracketsN(X)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `X` - Numeric value.
|
||||
|
||||
---
|
||||
|
||||
## >>> `semicolonC()` function: <<< <a name="semicolonc-function"></a> #######################
|
||||
|
||||
The **semicolonC()** function is internal function used by the *semicolon* format.
|
||||
Returns character value of length 32767.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
semicolonC(X)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `X` - Character value.
|
||||
|
||||
---
|
||||
|
||||
## >>> `semicolonN()` function: <<< <a name="semicolonn-function"></a> #######################
|
||||
|
||||
The **semicolonN()** function is internal function used by the *semicolon* format.
|
||||
Returns character value of length 33.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
semicolonN(X)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `X` - Numeric value.
|
||||
|
||||
---
|
||||
|
||||
## >>> `%QzipEvalf()` macro: <<< <a name="qzipevalf-macro"></a> #######################
|
||||
|
||||
The zipEvalf() and QzipEvalf() macro functions
|
||||
allow to use a function on elements of pair of
|
||||
space separated lists.
|
||||
|
||||
For two space separated lists of text strings the corresponding
|
||||
elements are taken and the macro applies a function, provided by user,
|
||||
to calculate result of the function on taken elements.
|
||||
|
||||
When one of the lists is shorter then elements are "reused" starting
|
||||
from the beginning.
|
||||
|
||||
The zipEvalf() returns unquoted value [by %unquote()].
|
||||
The QzipEvalf() returns quoted value [by %superq()].
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%QzipEvalf()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%QzipEvalf(
|
||||
first
|
||||
,second
|
||||
<,function=>
|
||||
<,operator=>
|
||||
<,argBf=>
|
||||
<,argMd=>
|
||||
<,argAf=>
|
||||
<,format=>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `first` - *Required*, a space separated list of texts.
|
||||
|
||||
2. `second` - *Required*, a space separated list of texts.
|
||||
|
||||
* `function = cat` - *Optional*, default value is `cat`,
|
||||
a function which will be applied
|
||||
to corresponding pairs of elements of
|
||||
the first and the second list.
|
||||
|
||||
* `operator =` - *Optional*, default value is empty,
|
||||
arithmetic infix operator used with elements
|
||||
the first and the second list. The first
|
||||
list is used on the left side of the operator
|
||||
the second list is used on the right side
|
||||
of the operator.
|
||||
|
||||
* `argBf =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*before* elements the first list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `argMd =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*between* elements the first list and
|
||||
the second list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `argAf =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*after* elements the second list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `format=` - *Optional*, default value is empty,
|
||||
indicates a format which should be used
|
||||
to format the result, does not work when
|
||||
the `operator=` is used.
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
See examples in `%zipEvalf()` help for the details.
|
||||
|
||||
---
|
||||
|
||||
## >>> `%zipEvalf()` macro: <<< <a name="zipevalf-macro"></a> #######################
|
||||
|
||||
The zipEvalf() and QzipEvalf() macro functions
|
||||
allow to use a function on elements of pair of
|
||||
space separated lists.
|
||||
|
||||
For two space separated lists of text strings the corresponding
|
||||
elements are taken and the macro applies a function, provided by user,
|
||||
to calculate result of the function on taken elements.
|
||||
|
||||
When one of the lists is shorter then elements are "reused" starting
|
||||
from the beginning.
|
||||
|
||||
The zipEvalf() returns unquoted value [by %unquote()].
|
||||
The QzipEvalf() returns quoted value [by %superq()].
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%zipEvalf()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%zipEvalf(
|
||||
first
|
||||
,second
|
||||
<,function=>
|
||||
<,operator=>
|
||||
<,argBf=>
|
||||
<,argMd=>
|
||||
<,argAf=>
|
||||
<,format=>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `first` - *Required*, a space separated list of texts.
|
||||
|
||||
2. `second` - *Required*, a space separated list of texts.
|
||||
|
||||
* `function = cat` - *Optional*, default value is `cat`,
|
||||
a function which will be applied
|
||||
to corresponding pairs of elements of
|
||||
the first and the second list.
|
||||
|
||||
* `operator =` - *Optional*, default value is empty,
|
||||
arithmetic infix operator used with elements
|
||||
the first and the second list. The first
|
||||
list is used on the left side of the operator
|
||||
the second list is used on the right side
|
||||
of the operator.
|
||||
|
||||
* `argBf =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*before* elements the first list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `argMd =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*between* elements the first list and
|
||||
the second list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `argAf =` - *Optional*, default value is empty,
|
||||
arguments of the function inserted
|
||||
*after* elements the second list.
|
||||
If multiple should be comma separated.
|
||||
|
||||
* `format=` - *Optional*, default value is empty,
|
||||
indicates a format which should be used
|
||||
to format the result, does not work when
|
||||
the `operator=` is used.
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Simple concatenation of elements:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let x = %zipEvalf(1 2 3 4 5 6, q w e r t y);
|
||||
%put &=x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Shorter list is "reused":
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let x = %zipEvalf(1 2 3 4 5 6, a b c);
|
||||
%put &=x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Use of the `operator=`, shorter list is "reused":
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let y = %zipEvalf(1 2 3 4 5 6, 100 200, operator = +);
|
||||
%put &=y;
|
||||
|
||||
%let z = %zipEvalf(1 2 3 4 5 6 8 9 10, 1 2 3 4 5 6 8 9 10, operator = **);
|
||||
%put &=z;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 4.** Format result:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let x = %zipEvalf(1 2 3 4 5 6, q w e r t y, format=$upcase.);
|
||||
%put &=x;
|
||||
|
||||
%put *
|
||||
%zipEvalf(
|
||||
ą ż ś ź ę ć ń ó ł
|
||||
,Ą Ż Ś Ź Ę Ć Ń Ó Ł
|
||||
,format = $brackets.
|
||||
)
|
||||
*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 5.** Use with macrovariables:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let abc = 10 100 1000;
|
||||
%put *
|
||||
%zipEvalf(
|
||||
%str(1 2 3 4 5 6 7 8 9)
|
||||
,&abc.
|
||||
,function = sum
|
||||
)
|
||||
*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 6.** If one of elements is empty:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put *
|
||||
%zipEvalf(
|
||||
abc efg
|
||||
,
|
||||
)
|
||||
*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 7.** Use of the `function=`, shorter list is "reused":
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put *
|
||||
%zipEvalf(
|
||||
a b c
|
||||
,efg
|
||||
,function = catx
|
||||
,argBf = %str(,)
|
||||
,format = $brackets.
|
||||
)
|
||||
*;
|
||||
|
||||
%put *
|
||||
%zipEvalf(
|
||||
a b c
|
||||
,efg
|
||||
,function = catx
|
||||
,argBf = %str( )
|
||||
,format = $upcase.
|
||||
)
|
||||
*;
|
||||
|
||||
%put *
|
||||
%zipEvalf(
|
||||
%str(! @ # $ [ ] % ^ & * )
|
||||
,1 2 3 4 5 6 7 8 9
|
||||
,function = catx
|
||||
,argBf = %str( )
|
||||
,format = $quote.
|
||||
)
|
||||
*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 8.** Use inside resolve:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data _null_;
|
||||
z = resolve('
|
||||
%zipEvalf(
|
||||
%nrstr(! @ # $ [ ] % ^ & *)
|
||||
,1 2 3 4 5 6 7 8 9
|
||||
,function = catx
|
||||
,argBf = %str(.)
|
||||
,format = $quote.
|
||||
)');
|
||||
put z=;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 9.** Use in data step:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data test;
|
||||
%zipEvalf(
|
||||
a b c d e f g
|
||||
,1 2 3 4 5 6 7
|
||||
,function = catx
|
||||
,argBf = =
|
||||
,format = $semicolon.
|
||||
)
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 10.** With 9.4M6 hashing() function:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %zipEvalf(MD5 SHA1 SHA256 SHA384 SHA512 CRC32, abcd, function = HASHING);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 11.** Use middle argument:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let x = %zipEvalf(1 2 3 4 5 6, 2020, argMd=5, function=MDY, format=date11.);
|
||||
%put &=x;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
|
||||
## License ####################################################################
|
||||
|
||||
Copyright (c) 2020 Bartosz Jablonski
|
||||
|
||||
Binary file not shown.
1150
packages/dfa.md
Normal file
1150
packages/dfa.md
Normal file
File diff suppressed because it is too large
Load Diff
BIN
packages/dfa.zip
BIN
packages/dfa.zip
Binary file not shown.
Reference in New Issue
Block a user