diff --git a/README.md b/README.md index a431823..ea60490 100644 --- a/README.md +++ b/README.md @@ -224,7 +224,7 @@ SHA256 digest for macroArray: F*85E3BE4D163AC5223B6EC9D3C25C46564A656E3830998B45 [MacroArray in SASPAC](https://github.com/SASPAC/macroarray "MacroArray in SASPAC") -- **BasePlus**\[1.20.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: +- **BasePlus**\[1.24.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: ```sas call arrMissToRight(myArray); call arrFillMiss(17, myArray); @@ -248,7 +248,7 @@ format x bool.; %put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$); ``` -SHA256 digest for BasePlus: F*F39F38CE80A5D8EED3BC9F2413CD6DEF38E8657E5DCF427CBA8938EB8C4350B6 +SHA256 digest for BasePlus: F*B297440903337E1AE6F12A6001B80B8AB743079847D16D63DF1C649AE51AA411 [Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus") diff --git a/packages/README.md b/packages/README.md index 9a328e9..c39d80f 100644 --- a/packages/README.md +++ b/packages/README.md @@ -86,7 +86,7 @@ SHA256 digest for macroArray: F*85E3BE4D163AC5223B6EC9D3C25C46564A656E3830998B45 --- -- **BasePlus**\[1.20.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: +- **BasePlus**\[1.24.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: ```sas call arrMissToRight(myArray); call arrFillMiss(17, myArray); @@ -110,7 +110,7 @@ format x bool.; %put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$); ``` -SHA256 digest for BasePlus: F*F39F38CE80A5D8EED3BC9F2413CD6DEF38E8657E5DCF427CBA8938EB8C4350B6 +SHA256 digest for BasePlus: F*B297440903337E1AE6F12A6001B80B8AB743079847D16D63DF1C649AE51AA411 [Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus") diff --git a/packages/SHA256_for_packages.txt b/packages/SHA256_for_packages.txt index 3f567b5..fdd0e63 100644 --- a/packages/SHA256_for_packages.txt +++ b/packages/SHA256_for_packages.txt @@ -1,3 +1,9 @@ +/* 20230503 */ +BasePlus: F*B297440903337E1AE6F12A6001B80B8AB743079847D16D63DF1C649AE51AA411 + +/* 20230419 */ +BasePlus: F*625E56B017C4AA8D436959C0A03C8503773A9A3823D43FA9E0326276E52DA6F2 + /* 20230417 */ BasePlus: F*F39F38CE80A5D8EED3BC9F2413CD6DEF38E8657E5DCF427CBA8938EB8C4350B6 diff --git a/packages/baseplus.md b/packages/baseplus.md index 55c4433..4b47153 100644 --- a/packages/baseplus.md +++ b/packages/baseplus.md @@ -52,12 +52,22 @@ * [`%bpPIPE()` macro](#bppipe-macro) * [`%dirsAndFiles()` macro](#dirsandfiles-macro) * [`%repeatTxt()` macro](#repeattxt-macro) + * [`%intsList()` macro](#intslist-macro) + * [`%letters()` macro](#letters-macro) + * [`%splitDSIntoBlocks()` macro](#splitdsintoblocks-macro) + * [`%splitDSIntoParts()` macro](#splitdsintoparts-macro) + * [`%filePath()` macro](#filepath-macro) + * [`%libPath()` macro](#libpath-macro) + * [`%workPath()` macro](#workpath-macro) + * [`%translate()` macro](#translate-macro) + * [`%tranwrd()` macro](#tranwrd-macro) + * [License](#license) --- -# The BasePlus package [ver. 1.20.0] ############################################### +# The BasePlus package [ver. 1.24.0] ############################################### The **BasePlus** package implements useful functions and functionalities I miss in the BASE SAS. @@ -199,7 +209,6 @@ Recording from the SAS Explore 2022 conference: [A BasePlus Package for SAS](htt %rainCloudPlot(sashelp.cars,DriveTrain,Invoice) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - **Example 10**: Zip SAS library. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas %zipLibrary(sashelp, libOut=work) @@ -237,62 +246,91 @@ run; %put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**EXAMPLE 15** Integer list: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +%put %intsList(42); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**EXAMPLE 16** Split dataset into blocks of 5 observations: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +%splitDSIntoBlocks(5, sashelp.class, classBlock) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**EXAMPLE 17** Split dataset into 7 parts: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +%splitDSIntoParts(7, sashelp.cars, carsPart) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +**EXAMPLE 18** Return path to temporary file: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + filename f temp; + %put %filePath(f); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --- Package contains: -1. macro bppipe -2. macro deduplistc -3. macro deduplistp -4. macro deduplists -5. macro deduplistx -6. macro dirsandfiles -7. macro functionexists -8. macro getvars -9. macro ldsn -10. macro ldsnm -11. macro lvarnm -12. macro lvarnmlab -13. macro qdeduplistx -14. macro qgetvars -15. macro qzipevalf -16. macro raincloudplot -17. macro repeattxt -18. macro symdelglobal -19. macro unziplibrary -20. macro zipevalf -21. macro ziplibrary -22. format bool -23. format boolz -24. format ceil -25. format floor -26. format int -27. functions arrfill -28. functions arrfillc -29. functions arrmissfill -30. functions arrmissfillc -31. functions arrmisstoleft -32. functions arrmisstoleftc -33. functions arrmisstoright -34. functions arrmisstorightc -35. functions bracketsc -36. functions bracketsn -37. functions catxfc -38. functions catxfi -39. functions catxfj -40. functions catxfn -41. functions deldataset -42. functions semicolonc -43. functions semicolonn -44. format brackets -45. format semicolon -46. proto qsortincbyprocproto -47. functions frommissingtonumberbs -48. functions fromnumbertomissing -49. functions quicksort4notmiss -50. functions quicksorthash -51. functions quicksorthashsddv -52. functions quicksortlight - +1. macro bppipe +2. macro deduplistc +3. macro deduplistp +4. macro deduplists +5. macro deduplistx +6. macro dirsandfiles +7. macro functionexists +8. macro getvars +9. macro intslist +10. macro ldsn +11. macro ldsnm +12. macro lvarnm +13. macro lvarnmlab +14. macro qdeduplistx +15. macro qgetvars +16. macro qzipevalf +17. macro raincloudplot +18. macro repeattxt +19. macro splitdsintoblocks +20. macro splitdsintoparts +21. macro symdelglobal +22. macro unziplibrary +23. macro zipevalf +24. macro ziplibrary +25. format bool +26. format boolz +27. format ceil +28. format floor +29. format int +30. function arrfill +31. function arrfillc +32. function arrmissfill +33. function arrmissfillc +34. function arrmisstoleft +35. function arrmisstoleftc +36. function arrmisstoright +37. function arrmisstorightc +38. function bracketsc +39. function bracketsn +40. function catxfc +41. function catxfi +42. function catxfj +43. function catxfn +44. function deldataset +45. function semicolonc +46. function semicolonn +47. format brackets +48. format semicolon +49. proto qsortincbyprocproto +50. function frommissingtonumberbs +51. function fromnumbertomissing +52. function quicksort4notmiss +53. function quicksorthash +54. function quicksorthashsddv +55. function quicksortlight +56. macro filepath +57. macro letters +58. macro libpath +59. macro translate +60. macro tranwrd +61. macro workpath Package contains additional content, run: %loadPackageAddCnt(BasePlus) to load it or look for the baseplus_AdditionalContent directory in the Packages fileref @@ -301,7 +339,7 @@ localization (only if additional content was deployed during the installation pr * SAS package generated by generatePackage, version 20230411 * The SHA256 hash digest for package BasePlus: -`F*F39F38CE80A5D8EED3BC9F2413CD6DEF38E8657E5DCF427CBA8938EB8C4350B6` +`F*B297440903337E1AE6F12A6001B80B8AB743079847D16D63DF1C649AE51AA411` --- # Content description ############################################################################################ @@ -4224,6 +4262,558 @@ run; --- +## >>> `%intsList()` macro: <<< ####################### + +The intsList() macro function allows to print a list of +integers starting from `start` up to `end` incremented by `by` +and separated by `sep=`. + +If `start`, `end` or `by` are non-integers the are converted to integers. + +See examples below for the details. + +The `%intsList()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%intsList( + start + <,end> + <,by> + <,sep=> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `start` - *Required*, the first value of the list. + If `end` is missing then the list is generated + from 1 to `start` by 1. + +2. `end` - *Required/Optional*, the last value of the list. + +3. `by` - *Required/Optional*, the increment of the list. + If missing then set to `1`. + *Cannot* be equal to `0`. + +* `s = %str( )` - *Optional*, it is a separator between + elements of the list. Default value is space. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Simple list of integers from 1 to 10 by 1: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %intsList(10); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** Ten copies of `sashelp.class` in `test11` to `test20`: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + data + %zipEvalf(test, %intsList(11,20)) + ; + set sashelp.class; + run; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Non-integers are converted to integers, the list is `1 3 5`: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %intsList(1.1,5.2,2.3); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 4.** A list with a separator: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %intsList(1,5,2,sep=+); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%letters()` macro: <<< ####################### + +The letters() macro function allows to print a list of Roman +letters starting from `start` up to `end` incremented by `by`. +The letters list can be uppercases or lowercase (parameter `c=U` or `c=L`), +can be quoted (e.g. `q=""` or `q=[]`), and can be separated by `s=`. + +Values of `start`, `end`, and `by` have to be integers in range between 1 ad 26. + +See examples below for the details. + +The `%letters()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%letters( + range + <,c=> + <,q=> + <,s=> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `range` - *Required*, letters selector in form `start:end:by`. + Lists letters from `start` to `end` by `by`. + Values of `start`, `end`, and `by` are separated by + colon and must be between 1 ad 26. + If value is outside range it is set to + `start=1`, `en=26`, and `by=1`. If `end` is missing + then is set to value of `start`. + If `end` is smaller than `start` list is reversed + +* `c = U` - *Optional*, it is a lowercase letters indicator. + Select `L` or `l`. Default value is `U` for upcase. + +* `q = ` - *Optional*, it is a quite around elements of the list. + Default value is empty. Use `%str()` for one quote symbol. + If there are multiple symbols, only the first and the + second are selected as a preceding and trailing one, + e.g. `q=[]` gives `[A] [B] ... [Z]`. + +* `s = %str( )` - *Optional*, it is a separator between + elements of the list. Default value is space. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Space separated list of capital letters from A to Z: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1:26:1); + + %put %letters(); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** First, thirteenth, and last letter: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1) %letters(13) %letters(26); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Every third lowercase letter, i.e. `a d g j m p s v y`: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1:26:3,c=L); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 4.** Lists with separators: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1:26:2,s=#); + %put %letters(1:26:3,s=%str(;)); + %put %letters(1:26:4,s=%str(,)); + %put %letters(1:26,s=); + %put %letters(1:26,s==); + %put %letters(1:26,s=/); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 5.** Every second letter with quotes: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1:26:2,q=%str(%')); + %put %letters(2:26:2,q=%str(%")); + + %put %letters(1:26:2,q=''); + %put %letters(2:26:2,q=""); + + %put %letters(1:26:2,q=<>); + %put %letters(2:26:2,q=\/); + + %put %letters(1:26:2,q=()); + %put %letters(2:26:2,q=][); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 6.** Mix of examples 4, 5, and 6: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(1:26,c=L,q='',s=%str(, )); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 7.** If `end` is smaller than `start` list is reversed: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %letters(26:1:2,q=''); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%splitDSIntoBlocks()` macro: <<< ####################### + +The splitDSIntoBlocks() macro allows to split the `set` dataset into blocks +of size `blockSize` in datasets: `prefix1` to `prefixN`. + +The last dataset may have less observations then the `blockSize`. + +Macro covers `BASE` engine (`v9`, `v8`, `v7`, `v6`) and `SPDE` engine datasets. + +See examples below for the details. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%splitDSIntoBlocks( + blockSize + <,set> + <,prefix> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `blockSize` - *Required*, the size of the block of data, + in other words number of observations in + one block of split data. + Block size must be positive integer. + +2. `set` - *Required/Optional*, the name of the dataset to split. + If empty then `&syslast.` is used. + +3. `prefix` - *Required/Optional*, the name-prefix for new datasets. + If missing then set to `part`. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Split `sashelp.class` into 5 elements datasets ABC1 to ABC4: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %splitDSIntoBlocks(5,sashelp.class,ABC) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** By default splits the `_last_` dataset into `part1` to `partN` datasets: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + data lastData; + set sashelp.cars; + run; + + %splitDSIntoBlocks(123) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Works with `SPDE` engine too: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + options dlcreatedir; + libname test "%sysfunc(pathname(work))/testSPDE"; + libname test; + libname test SPDE "%sysfunc(pathname(work))/testSPDE"; + + data test.test; + set sashelp.cars; + run; + + %splitDSIntoBlocks(100,test.test,work.spde) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%splitDSIntoParts()` macro: <<< ####################### + +The splitDSIntoParts() macro allows to split the `set` dataset into `parts` parts +of approximately `NOBS/parts` size in datasets: `prefix1` to `prefixN`. + +The splitDSIntoParts() macro internally runs the splitDSIntoBlocks() macro. + +Macro covers `BASE` engine (`v9`, `v8`, `v7`, `v6`) and `SPDE` engine datasets. + +See examples below for the details. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%splitDSIntoParts( + parts + <,set> + <,prefix> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `parts` - *Required*, the number of parts to split data into. + Number of parts must be positive integer. + +2. `set` - *Required/Optional*, the name of the dataset to split. + If empty then `&syslast.` is used. + +3. `prefix` - *Required/Optional*, the name-prefix for new datasets. + If missing then set to `part`. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Split `sashelp.cars` into 7 parts: datasets carsInParts1 to carsInParts7: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %splitDSIntoParts(7,sashelp.cars, carsInParts) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** By default splits the `_last_` dataset into `part1` to `part3` datasets: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + data lastData; + set sashelp.cars; + run; + + %splitDSIntoBlocks(3) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Works with `SPDE` engine too: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + options dlcreatedir; + libname test "%sysfunc(pathname(work))/testSPDE"; + libname test; + libname test SPDE "%sysfunc(pathname(work))/testSPDE"; + + data test.test; + set sashelp.cars; + run; + + %splitDSIntoParts(3,test.test,work.spde) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%filePath()` macro: <<< ####################### + +The filePath() macro function returns path to a file, +it is a wrapper to `pathname()` function for files. + +See examples below for the details. + +The `%filePath()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%filePath( + fileref +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `fileref` - *Required*, a fileref from the `filename` statement. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Return path to temporary file: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + filename f temp; + %put %filePath(f); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%libPath()` macro: <<< ####################### + +The libPath() macro function returns path to a library, +it is a wrapper to `pathname()` function for libraries. + +See examples below for the details. + +The `%libPath()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%libPath( + libref +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `libref` - *Required*, a libref from the `libname` statement. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Return path to `WORK` library: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %libPath(WORK); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** Return path to `SASHELP` library: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %libPath(SASHELP); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%workPath()` macro: <<< ####################### + +The workPath() macro function returns path to the `WORK` library, +it is a wrapper to `pathname("work", "L")` function. + +See examples below for the details. + +The `%workPath()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%workPath() +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +*) No arguments. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Create new library inside `WORK` library: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + options dlCreateDir; + libname NEW "%workPath()/new"; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%translate()` macro: <<< ####################### + +The translate() macro function allows to replace bytes with bytes in text string. + +See examples below for the details. + +The `%translate()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%translate( + string + ,from + ,to +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `string` - *Required*, string to modify. + +2. `from` - *Required*, list of bytes to be replaced with + corresponding bytes from `to`. + +3. `to` - *Required*, list of bytes replacing + corresponding bytes from `from`. + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Replace quotes and commas with apostrophes and spaces: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %translate(%str("A", "B", "C"),%str(%",),%str(%' )); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** Unify all brackets; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %translate(%str([A] {B} (C) ),{[(<>)]},(((())))); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Replace all digits with `*`: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %translate(QAZ1WSSX2EDC3RFV4TGB5YHN6UJM7IK8OL9P0,1234567890,**********); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 4.** Letters change: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %translate(%str(A=B),AB,BA); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +## >>> `%tranwrd()` macro: <<< ####################### + +The tranwrd() macro function allows to replace substrings +with other substrings in text string. + +Returned string is unquoted by `%unquote()`. + +See examples below for the details. + +The `%tranwrd()` macro executes like a pure macro code. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%tranwrd( + string + ,from + ,to + <,repeat> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `string` - *Required*, string to modify. + +2. `from` - *Required*, substring replaced with + corresponding string from `to`. + +3. `to` - *Required*, substring replacing + corresponding substring from `from`. + +4. `repeat` - *Optional*, number of times the replacing + should be repeated, default is 1. + Useful while removing multiple adjacent + characters, e.g. compress all multiple + spaces (see example 2). +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Simple text replacement: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %tranwrd(Miss Joan Smith,Miss,Ms.); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** Delete multiple spaces; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %tranwrd(%str(A B C),%str( ),%str( ),5); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 3.** Remove substring: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %put %tranwrd(ABCxyzABCABCxyzABC,ABC); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + +--- + +--- + ## License #################################################################### Copyright (c) since 2020 Bartosz Jablonski diff --git a/packages/baseplus.zip b/packages/baseplus.zip index 4eec6fa..91ba702 100644 Binary files a/packages/baseplus.zip and b/packages/baseplus.zip differ