mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-03 05:10:05 +00:00
The BasePlus package [ver. 1.16]
The BasePlus package [ver. 1.16] - improvement to: %LDSN(), %LVarNm(), and %LVarNmLab() macros. Big thanks to Richard DeVenezia! hash: 4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
This commit is contained in:
@@ -146,7 +146,7 @@ SHA256 digest for macroArray: DF63B0E027827A82038F1C8422787A0BC569BA93104BA1778D
|
|||||||
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
|
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/macroarray.md "Documentation for macroArray")
|
||||||
|
|
||||||
|
|
||||||
- **BasePlus**\[1.15\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
- **BasePlus**\[1.16\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||||
```sas
|
```sas
|
||||||
call arrMissToRight(myArray);
|
call arrMissToRight(myArray);
|
||||||
call arrFillMiss(17, myArray);
|
call arrFillMiss(17, myArray);
|
||||||
@@ -164,7 +164,7 @@ format x bool.;
|
|||||||
|
|
||||||
%zipLibrary(sashelp,libOut=work)
|
%zipLibrary(sashelp,libOut=work)
|
||||||
```
|
```
|
||||||
SHA256 digest for BasePlus: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
|
SHA256 digest for BasePlus: 4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
|
||||||
|
|
||||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ SHA256 digest for macroArray: DF63B0E027827A82038F1C8422787A0BC569BA93104BA1778D
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- **BasePlus**\[1.15\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
- **BasePlus**\[1.16\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||||
```sas
|
```sas
|
||||||
call arrMissToRight(myArray);
|
call arrMissToRight(myArray);
|
||||||
call arrFillMiss(17, myArray);
|
call arrFillMiss(17, myArray);
|
||||||
@@ -108,7 +108,7 @@ format x bool.;
|
|||||||
|
|
||||||
%zipLibrary(sashelp,libOut=work)
|
%zipLibrary(sashelp,libOut=work)
|
||||||
```
|
```
|
||||||
SHA256 digest for BasePlus: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
|
SHA256 digest for BasePlus: 4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
|
||||||
|
|
||||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
/* 20220509 */
|
||||||
|
BasePlus:4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E
|
||||||
|
|
||||||
/* 20220508 */
|
/* 20220508 */
|
||||||
BasePlus: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
|
BasePlus: 0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# The BasePlus package [ver. 1.15] <a name="baseplus-package"></a> ###############################################
|
# The BasePlus package [ver. 1.16] <a name="baseplus-package"></a> ###############################################
|
||||||
|
|
||||||
The **BasePlus** package implements useful
|
The **BasePlus** package implements useful
|
||||||
functions and functionalities I miss in the BASE SAS.
|
functions and functionalities I miss in the BASE SAS.
|
||||||
@@ -272,7 +272,7 @@ Package contains:
|
|||||||
*SAS package generated by generatePackage, version 20220420*
|
*SAS package generated by generatePackage, version 20220420*
|
||||||
|
|
||||||
The SHA256 hash digest for package BasePlus:
|
The SHA256 hash digest for package BasePlus:
|
||||||
`0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9`
|
`4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E`
|
||||||
|
|
||||||
---
|
---
|
||||||
# Content description ############################################################################################
|
# Content description ############################################################################################
|
||||||
@@ -3593,23 +3593,6 @@ The `%LDSN()` macro executes like a pure macro code.
|
|||||||
`%ldsn(work.test)`, `%ldsn( work.test)`, `%ldsn(work.test )`,
|
`%ldsn(work.test)`, `%ldsn( work.test)`, `%ldsn(work.test )`,
|
||||||
`%ldsn(work .test)`, `%ldsn(work. test)`, `%ldsn(work . test)`.
|
`%ldsn(work .test)`, `%ldsn(work. test)`, `%ldsn(work . test)`.
|
||||||
|
|
||||||
- if the user want to add an extra suffix to the dataset the `%ldsn()` macro
|
|
||||||
**has** to be wrapped inside the `%unquote()` macro function.
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
|
||||||
data
|
|
||||||
%unquote(%LDSN(WORK.some strange! DS name))_1
|
|
||||||
%unquote(%LDSN(WORK.some strange! DS name))_2
|
|
||||||
;
|
|
||||||
set sashelp.class;
|
|
||||||
|
|
||||||
if SEX="M" then output %unquote(%LDSN(WORK.some strange! DS name))_1;
|
|
||||||
else output %unquote(%LDSN(WORK.some strange! DS name))_2;
|
|
||||||
run;
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
The reason for this is a "bug" like behaviour of SAS tokenizer/macroprocesor.
|
|
||||||
See the following SAS-L discussion thread:
|
|
||||||
`https://listserv.uga.edu/scripts/wa-UGA.exe?A2=SAS-L;4b2bcf80.2205A&S=`
|
|
||||||
|
|
||||||
- macro calls of the form:
|
- macro calls of the form:
|
||||||
`data %LDSN(); run;`, `data %LDSN( ); run;`, `data %LDSN( . ); run;` or even
|
`data %LDSN(); run;`, `data %LDSN( ); run;`, `data %LDSN( . ); run;` or even
|
||||||
`data %LDSN( . (keep=x)); run;` are resolved to empty string, so the result is
|
`data %LDSN( . (keep=x)); run;` are resolved to empty string, so the result is
|
||||||
@@ -3671,23 +3654,6 @@ The `%LVarNm()` macro executes like a pure macro code.
|
|||||||
e.g. the following will give the same hash digest:
|
e.g. the following will give the same hash digest:
|
||||||
`%LVarNm(test)`, `%LVarNm( test)`, `%LVarNm(test )`.
|
`%LVarNm(test)`, `%LVarNm( test)`, `%LVarNm(test )`.
|
||||||
|
|
||||||
- if the user want to add an extra suffix to the variable,
|
|
||||||
e.g. to get a numerical suffix, the `%LVarNm()` macro
|
|
||||||
**has** to be wrapped inside the `%unquote()` macro function.
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
|
||||||
data test4;
|
|
||||||
array X[*] %unquote(%LVarNm(some strange! name))_0 - %unquote(%LVarNm(some strange! name))_10;
|
|
||||||
|
|
||||||
do i = lbound(X) to hbound(X);
|
|
||||||
X[i] = 2**(i-1);
|
|
||||||
put X[i]=;
|
|
||||||
end;
|
|
||||||
run;
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
The reason for this is a "bug" like behaviour of SAS tokenizer/macroprocesor.
|
|
||||||
See the following SAS-L discussion thread:
|
|
||||||
`https://listserv.uga.edu/scripts/wa-UGA.exe?A2=SAS-L;4b2bcf80.2205A&S=`
|
|
||||||
|
|
||||||
### SYNTAX: ###################################################################
|
### SYNTAX: ###################################################################
|
||||||
|
|
||||||
The basic syntax is the following, the `<...>` means optional parameters:
|
The basic syntax is the following, the `<...>` means optional parameters:
|
||||||
@@ -3751,7 +3717,7 @@ run;
|
|||||||
**EXAMPLE 4.**
|
**EXAMPLE 4.**
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||||
data test4;
|
data test4;
|
||||||
array X[*] %unquote(%LVarNm(some strange! name))_0 - %unquote(%LVarNm(some strange! name))_10;
|
array X[*] %LVarNm(some strange! name)_0 - %LVarNm(some strange! name)_10;
|
||||||
|
|
||||||
do i = lbound(X) to hbound(X);
|
do i = lbound(X) to hbound(X);
|
||||||
X[i] = 2**(i-1);
|
X[i] = 2**(i-1);
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user