mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-07 15:10:04 +00:00
macroArray, version 0.7: The `%mcHashTable()` macro was added in the package. It is designed to facilitate the idea of a "macro hash table" concept, i.e. *a list of macrovariables with common prefix and suffixes generated as a hash digest* which allows to use values other than integers as indexes. The `%mcHashTable()` macro allows to generate other macros which behaves like hash tables or dictionaries.
108 lines
3.1 KiB
Markdown
108 lines
3.1 KiB
Markdown
## SAS Packages:
|
|
To get started with SAS Packages try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/master/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
|
|
|
|
## Available packages:
|
|
Currently the following packages are available:
|
|
|
|
---
|
|
|
|
- **SQLinDS**\[2.2\], based on Mike Rhoads' article *Use the Full Power of SAS in Your Function-Style Macros*. The package allows to write SQL queries in the data step, e.g.
|
|
```
|
|
data class;
|
|
set %SQL(
|
|
select age, name, weight, height
|
|
from sashelp.class
|
|
order by age
|
|
);
|
|
|
|
WH = weight + height;
|
|
run;
|
|
```
|
|
SHA256 digest for SQLinDS: 135DC50C0412B8CEAF6D5349B8A203C0ADB23D4F5C2680B6A35FD2E5482B6C49
|
|
|
|
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/sqlinds.md "Documentation for SQLinDS")
|
|
|
|
---
|
|
|
|
- **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.
|
|
```
|
|
%createDFArray(ArrDynamic, resizefactor=17);
|
|
|
|
data _null_;
|
|
call ArrDynamic("Allocate", -2, 2);
|
|
|
|
do i = -2 to 2;
|
|
call ArrDynamic("Input", i, 2**i);
|
|
end;
|
|
|
|
L = .; H = .;
|
|
call ArrDynamic("Dim", L, H);
|
|
put L= H=;
|
|
|
|
call ArrDynamic("+", 3, 8);
|
|
call ArrDynamic("+",-3, 0.125);
|
|
call ArrDynamic("Dim", L, H);
|
|
put L= H=;
|
|
|
|
Value = .;
|
|
do i = L to H;
|
|
call ArrDynamic("O", i, Value);
|
|
put i= Value=;
|
|
end;
|
|
run;
|
|
```
|
|
SHA256 digest for DFA: E67A0863992722A5F535F56E14EF8D19A55F74FB374447BF11B5ED74029C29CB
|
|
|
|
---
|
|
|
|
- **macroArray**\[0.7\], implementation of an array concept in a macro language, e.g.
|
|
```
|
|
%array(ABC[17] (111:127), macarray=Y);
|
|
|
|
%macro test();
|
|
%do i = 1 %to 17;
|
|
%put &i.) %ABC(&i.);
|
|
%end;
|
|
%mend;
|
|
%test()
|
|
|
|
%let %ABC(13,i) = 99999; /* i = insert */
|
|
|
|
%do_over(ABC, phrase=%nrstr(
|
|
%put &_i_.%) %ABC(&_i_.);
|
|
),
|
|
which = 1:H:2
|
|
);
|
|
```
|
|
SHA256 digest for macroArray: 75056F508E96296DC50096BBB054C58334DB913AD37885958099EDCE0C330CB2
|
|
|
|
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/macroarray.md "Documentation for macroArray")
|
|
|
|
---
|
|
|
|
- **BasePlus**\[0.8\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
|
```
|
|
call arrMissToRight(myArray);
|
|
call arrFillMiss(17, myArray);
|
|
call arrFill(42, myArray);
|
|
|
|
rc = delDataset("DataSetToDrop");
|
|
|
|
string = catXFn("date9.", "#", myArray);
|
|
|
|
format x bool.;
|
|
|
|
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
|
```
|
|
SHA256 digest for BasePlus: 9549378E5F81DA4DC421C366DF006D270261852336CE3DCD88FF8E2A759938C8
|
|
|
|
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/baseplus.md "Documentation for BasePlus")
|
|
|
|
---
|
|
|
|
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
|
|
|
SHA256 digest for dynMacroArray: 694AACE925B7F4E149C3B90383F56370ED76233D8F5040713D66C1F3A4E414FE
|
|
|
|
---
|