diff --git a/packages/README.md b/packages/README.md index 48ed746..ab654a5 100644 --- a/packages/README.md +++ b/packages/README.md @@ -61,7 +61,7 @@ SHA256 digest for DFA: F*09EA5201360922A91A9EEE72F4567792E9CFDFB591BA33419E2BF2B --- -- **macroArray**\[1.0.6\], implementation of an array concept in a macro language, e.g. +- **macroArray**\[1.1.0\], implementation of an array concept in a macro language, e.g. ```sas %array(ABC[17] (111:127), macarray=Y); @@ -80,7 +80,7 @@ SHA256 digest for DFA: F*09EA5201360922A91A9EEE72F4567792E9CFDFB591BA33419E2BF2B which = 1:H:2 ); ``` -SHA256 digest for macroArray: F*4FAAEE7DF2854EA31933AE017A89C1615C7291A66A07CCE345041EB0D587ED4E +SHA256 digest for macroArray: F*6A22A01868F4203862B3685F543D723C7DB8E9AB3C1A6357D2BFA030971B0D3C [Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray") diff --git a/packages/SHA256_for_packages.txt b/packages/SHA256_for_packages.txt index a92fc15..368aa25 100644 --- a/packages/SHA256_for_packages.txt +++ b/packages/SHA256_for_packages.txt @@ -1,3 +1,6 @@ +/* 20230906 */ +macroArray: F*6A22A01868F4203862B3685F543D723C7DB8E9AB3C1A6357D2BFA030971B0D3C + /* 20230904 */ BasePlus: F*2FE68DD9B3692B9D46EF85B82F63C7E65010BF9E89D670FD1779F4670FA03F31 DFA: F*09EA5201360922A91A9EEE72F4567792E9CFDFB591BA33419E2BF2B31D9B7C62 diff --git a/packages/macroarray.md b/packages/macroarray.md index 7f2e20e..fdeb46d 100644 --- a/packages/macroarray.md +++ b/packages/macroarray.md @@ -278,6 +278,7 @@ The basic syntax is the following, the `<...>` means optional parameters: <,macarray=N> <,ds=> <,vars=> + <,q=> ) ~~~~~~~~~~~~~~~~~~~~~~~ @@ -312,8 +313,8 @@ The basic syntax is the following, the `<...>` means optional parameters: `%array(myArr[*] x1-x3 (4:6), vnames=Y)` will use `x1`, `x2`, and `x3` as values instead `4`, `5`, and `6`. -* `macarray=N` - *Optional*, default value `N`, if set to `Y`/`YES` then macro named with array - name is compiled to create convenient envelope for multiple ampersands, e.g. +* `macarray=N` - *Optional*, default value `N`, if set to `Y`/`YES` then a macro, named with the array + name, is compiled to create convenient envelope for multiple ampersands, e.g. `%array(myArr[*] x1-x3 (4:6), macarray=Y)` will create `%myArr(J)` macro which will allow to extract "data" from macroarray like: @@ -325,8 +326,8 @@ The basic syntax is the following, the `<...>` means optional parameters: macrovariables with prefix like the array name and numeric suffixes, then the minimum and the maximum index is determined and all not existing global macrovariables are created and - a macro is generated in the same way as for the `Y` value - + a macro is generated in the same way as for the `Y` value. + * `ds=` - *Optional*, use a dataset as a basis for a macroarray data, if used by default overwrites use of the `array` parameter, honors `macarray=` argument, dataset options are allowed, e.g. `sashelp.class(obs=5)` @@ -343,23 +344,27 @@ The basic syntax is the following, the `<...>` means optional parameters: 2) macroarray "WEIGHT" with ALL(no separator is equivalent to #) values of variable "weight"
3) macroarray "W" with UNIQUE(|) values of variable "weight" and
- 4) macroarray "AGE" with UNIQUE(|) values of variable "age", - + 4) macroarray "AGE" with UNIQUE(|) values of variable "age". + +* `q=` - *Optional*, indicates (when set to `1`) if the value be surrounded by quotes. + It uses `quote(cats(...))` combo under the hood. Default value is `0`. + Ignored for `macarray=M`. +--- ### EXAMPLES AND USECASES: #################################################### **EXAMPLE 1.** Basic use-case. - Creating macroarray like in the array statement; - values are used by default; - different types of brackets are allowed; + Creating macroarray like in the array statement. + Values not variables names are used by default. + Different types of brackets are allowed. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas %array(a[*] x1-x5 (1:5)) - %array(b{5} (5*17)) + %array(b{5} (5*17), q=1) %* Mind the $ since it is a character array!; %array(c(3) $ 10 ("a A" "b,B" "c;C")) @@ -405,7 +410,7 @@ The basic syntax is the following, the `<...>` means optional parameters: %put &=g0. &=g1. &=g2.; %* Or something more complex; - %array(gg[0:11] $ 11, function = put(intnx("MONTH", '1jun2018'd, _I_, "E"), yymmn.)) + %array(gg[0:11] $ 11, function = put(intnx("MONTH", '1jun2018'd, _I_, "E"), yymmn.), q=1) %put &=ggLBOUND. &=ggHBOUND. &=ggN.; %put &=gg0 &=gg1 &=gg2 ... &=gg11; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -433,10 +438,10 @@ The basic syntax is the following, the `<...>` means optional parameters: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -**EXAMPLE 6a.** "Uppercas Letters" +**EXAMPLE 6a.** Quoted "Uppercas Letters" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas - %array(UL[26] $, function = byte(rank("A")+_I_-1) ) + %array(UL[26] $, function = byte(rank("A")+_I_-1) , q=1) %put &=UL1 &=UL2 ... &=UL25 &=UL26; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -451,7 +456,7 @@ The basic syntax is the following, the `<...>` means optional parameters: %* The range handling, warning; %put *%ll(265)*; - + %* The input mode; %put *before:*%ll(2)*; %let %ll(2,I) = bbbbb; @@ -576,10 +581,10 @@ The basic syntax is the following, the `<...>` means optional parameters: Currently the only separator in VARS is a space. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas - %array(ds = sashelp.class, vars = height#h weight weight|w age|) + %array(ds = sashelp.class, vars = height#h weight weight|w age|, q=1) %put _user_; - %array(ds = sashelp.class, vars = height#hght weight weight|wght age|, macarray=Y) + %array(ds = sashelp.class, vars = height#hght weight weight|wght age|, macarray=Y, q=1) %put *%hght(&hghtLBOUND.)**%weight(2)**%wght(&wghtHBOUND.)**%age(3)*; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -599,7 +604,7 @@ The basic syntax is the following, the `<...>` means optional parameters: %let myTest6 = 16; %let myTest9 = 19; - %array(myTest, macarray=M) + %array(myTest, macarray=M, q=1) %do_over(myTest, phrase = %nrstr(%put *&_I_.*%myTest(&_I_.)*;)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/packages/macroarray.zip b/packages/macroarray.zip index a047b7b..411c831 100644 Binary files a/packages/macroarray.zip and b/packages/macroarray.zip differ