mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-07 15:10:04 +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:
@@ -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
|
||||
functions and functionalities I miss in the BASE SAS.
|
||||
@@ -272,7 +272,7 @@ Package contains:
|
||||
*SAS package generated by generatePackage, version 20220420*
|
||||
|
||||
The SHA256 hash digest for package BasePlus:
|
||||
`0331C673052D5221DA98C5CC93295634D8A0BC62C7D2FEF9D0D85B0B2DEDE4E9`
|
||||
`4CD3926B9842925C86B80B5B47B47BEA1FB9707826B545B9B4D52AE97BC3617E`
|
||||
|
||||
---
|
||||
# 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)`.
|
||||
|
||||
- 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:
|
||||
`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
|
||||
@@ -3671,23 +3654,6 @@ The `%LVarNm()` macro executes like a pure macro code.
|
||||
e.g. the following will give the same hash digest:
|
||||
`%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: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
@@ -3751,7 +3717,7 @@ run;
|
||||
**EXAMPLE 4.**
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
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);
|
||||
X[i] = 2**(i-1);
|
||||
|
||||
Reference in New Issue
Block a user