diff --git a/packages/README.md b/packages/README.md index 943a8e4..553f7b9 100644 --- a/packages/README.md +++ b/packages/README.md @@ -86,7 +86,7 @@ SHA256 digest for macroArray: F*2A108D121D4DACAA8752E681301371F80F0500B2EE28A9E3 --- -- **BasePlus**\[1.34.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: +- **BasePlus**\[1.35.0\] adds a bunch of functionalities I am missing in BASE SAS, such as: ```sas call arrMissToRight(myArray); call arrFillMiss(17, myArray); @@ -114,7 +114,7 @@ format x bool.; %put %monthShift(2023,1,-5); ``` -SHA256 digest for BasePlus: F*D84CE41A550DC2D5C092C70C04A796E8329F34087A603BEF0CD366910C162E80 +SHA256 digest for BasePlus: F*62344EAA8C0DD95CCB164B5C7A91B33865B3D19CD5A2A3EDAC4C31E0541D04C9 [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 5802292..8d43de3 100644 --- a/packages/SHA256_for_packages.txt +++ b/packages/SHA256_for_packages.txt @@ -1,3 +1,6 @@ +/* 20231114 */ +BasePlus: F*62344EAA8C0DD95CCB164B5C7A91B33865B3D19CD5A2A3EDAC4C31E0541D04C9 + /* 20231111 */ BasePlus: F*D84CE41A550DC2D5C092C70C04A796E8329F34087A603BEF0CD366910C162E80 DFA: F*012375D87F66EB3A7BF5DDD0CC5AEE28851733EE33CC63231DF9045BEB958168 diff --git a/packages/baseplus.md b/packages/baseplus.md index 66d02fe..fab46b2 100644 --- a/packages/baseplus.md +++ b/packages/baseplus.md @@ -47,6 +47,7 @@ * [`%unzipLibrary()` macro](#unziplibrary-macro) * [`%zipArch()` macro](#ziparch-macro) * [`%unzipArch()` macro](#unziparch-macro) + * [`%findDSwithVarVal()` macro](#finddswithvarval-macro) * [`%LDSN()` macro](#ldsn-macro) * [`%LDsNm()` macro](#ldsnm-macro) * [`%LVarNm()` macro](#lvarnm-macro) @@ -80,7 +81,7 @@ --- -# The BasePlus package [ver. 1.34.0] ############################################### +# The BasePlus package [ver. 1.35.0] ############################################### The **BasePlus** package implements useful functions and functionalities I miss in the BASE SAS. @@ -102,7 +103,8 @@ Kudos to all who inspired me to generate this package: *Michal Ludwicki*, *Quentin McMullen*, *Kurt Bremser*, -*Leonid Batkhan*. +*Leonid Batkhan*, +*Louise Hadden*. --- @@ -400,6 +402,16 @@ run; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +**EXAMPLE 26** Downloading data from the internet to a local dirrectory: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +%downloadFilesTo(~/directoryA) +datalines4; +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-189.pdf +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-189.zip +;;;; +run; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + --- @@ -463,21 +475,22 @@ Package contains: 57. functions quicksortlight 58. macro date 59. macro datetime -60. macro filepath -61. macro finddswithvarval -62. macro fmt -63. macro gettitle -64. macro infmt -65. macro letters -66. macro libpath -67. macro minclude -68. macro monthshift -69. macro replist -70. macro time -71. macro today -72. macro translate -73. macro tranwrd -74. macro workpath +60. macro downloadfilesto +61. macro filepath +62. macro finddswithvarval +63. macro fmt +64. macro gettitle +65. macro infmt +66. macro letters +67. macro libpath +68. macro minclude +69. macro monthshift +70. macro replist +71. macro time +72. macro today +73. macro translate +74. macro tranwrd +75. macro workpath @@ -488,7 +501,7 @@ localization (only if additional content was deployed during the installation pr * SAS package generated by generatePackage, version 20231107 * The SHA256 hash digest for package BasePlus: -`F*D84CE41A550DC2D5C092C70C04A796E8329F34087A603BEF0CD366910C162E80` +`F*62344EAA8C0DD95CCB164B5C7A91B33865B3D19CD5A2A3EDAC4C31E0541D04C9` --- # Content description ############################################################################################ @@ -4051,6 +4064,125 @@ filename pR "%workPath()"; --- +## >>> `%downloadFilesTo()` macro: <<< ####################### + +The downloadFilesTo() macro copy files (in binary mode +using `filename()` function with options `lrecl=1 recfm=n`) +from list provided by user to a directory indicated +in the macro call. + +Macro can be executed in two possible ways: +1) by providing list of files to download in a `datalines4`(`cards4`) list + directly after macro call: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %downloadFilesTo() + datalines4; + + + ... + + ;;;; + run; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +2) by create a dataset with a list of links and use of `DS=` and `DSvar=` parameters. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas + %downloadFilesTo( + , DS= + , DSvar= + ) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +See examples below for the details. + +The `%downloadFilesTo()` macro **does not** execute as a pure macro code. + +Temporary dataset `work.______locationInfoData` is generated during processing. + +### SYNTAX: ################################################################### + +The basic syntax is the following, the `<...>` means optional parameters: +~~~~~~~~~~~~~~~~~~~~~~~sas +%downloadFilesTo( + target + <,DS=> + <,DSvar=link> + <,inDev=URL> + <,outDev=DISK> + <,inOptions=> + <,outOptions=> +) +~~~~~~~~~~~~~~~~~~~~~~~ + +**Arguments description**: + +1. `target ` - *Required*, a path to target directory. + If empty the `WORK` location is used. + +*. `DS= ` - *Optional*, name of data set with list + of files to download. + +*. `DSvar= ` - *Optional*, name of variable in data set + with list of files to download. + + +*. `inDev=` - *Optional*, type of device used by the + `filename()` function to access incoming files. + Default value is `URL`. + +*. `outDev=` - *Optional*, type of device used by the + `filename()` function to access outgoing files. + Default value is `DISK`. + +*. `inOptions=` - *Optional*, list of additional options for the + `filename()` function to access incoming files. + Default value is empty. + +*. `outOptions=` - *Optional*, list of additional options for the + `filename()` function to access outgoing files. + Default value is empty. + + +--- + +### EXAMPLES AND USECASES: #################################################### + +**EXAMPLE 1.** Download data from web with diect list and then copy between directories: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +resetline; +%downloadFilesTo(~/directoryA) +datalines4; +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-189.pdf +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-189.zip +;;;; +run; + +%downloadFilesTo(~/directoryB,inDev=DISK) +datalines4; +~/directoryA/WUSS-2023-Paper-189.pdf +~/directoryA/WUSS-2023-Paper-189.zip +;;;; +run; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + +**EXAMPLE 2.** Download data from web using data set with list: +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas +resetline; +data listOfFiles; +infile cards; +input files :$1024.; +cards4; +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-201.pdf +https://www.lexjansen.com/wuss/2023/WUSS-2023-Paper-109.pdf +;;;; +run; + +%downloadFilesTo(R:\directoryC, DS=listOfFiles, DSvar=files) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +--- + ## >>> `%LDSN()` macro: <<< ####################### The LDSN (Long DataSet Names) macro function diff --git a/packages/baseplus.zip b/packages/baseplus.zip index 700e6c8..70b4220 100644 Binary files a/packages/baseplus.zip and b/packages/baseplus.zip differ