Skip to content

Commit 0e83226

Browse files
authored
Merge pull request #47 from SASPAC/dev
The BasePlus package [ver. 2.3.0]
2 parents 2c7713a + 059f7fe commit 0e83226

12 files changed

Lines changed: 7755 additions & 17 deletions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ libname NEW "%workPath()/new";
5656
```
5757
and more.
5858

59-
SHA256 digest for the latest version of `BasePlus`: F*DFA83F8E0D7424DEB63D49620392068BC68D766552E2804CB6B01DE8E5A87769
59+
SHA256 digest for the latest version of `BasePlus`: F*71DC1AFA709B2977E8AEA452721776F62EEC8240ABD658AC83AA6D4310FC49B6
6060

6161
[**Documentation for BasePlus**](./baseplus.md "Documentation for BasePlus")
6262

baseplus.md

Lines changed: 74 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@
99
### Version information:
1010

1111
- Package: BasePlus
12-
- Version: 2.1.0
13-
- Generated: 2024-09-09T12:55:04
12+
- Version: 2.3.0
13+
- Generated: 2025-08-04T14:12:30
1414
- Author(s): Bartosz Jablonski (yabwon@gmail.com), Quentin McMullen (qmcmullen@gmail.com)
1515
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
1616
- License: MIT
17-
- File SHA256: `F*DFA83F8E0D7424DEB63D49620392068BC68D766552E2804CB6B01DE8E5A87769` for this version
18-
- Content SHA256: `C*AB16F5B6538515607C3C254E401DC1ACA7293AB36990227F6E7792145CEEAB87` for this version
17+
- File SHA256: `F*71DC1AFA709B2977E8AEA452721776F62EEC8240ABD658AC83AA6D4310FC49B6` for this version
18+
- Content SHA256: `C*9CEDE8C64D2C619EBC27AC85B4904D2CE2423C832C6C313E526946FC1417EFD1` for this version
1919

2020
---
2121

22-
# The `BasePlus` package, version: `2.1.0`;
22+
# The `BasePlus` package, version: `2.3.0`;
2323

2424
---
2525

2626

27-
# The BasePlus package [ver. 2.1.0] <a name="baseplus-package"></a> ###############################################
27+
# The BasePlus package [ver. 2.3.0] <a name="baseplus-package"></a> ###############################################
2828

2929
The **BasePlus** package implements useful
3030
functions and functionalities I miss in the BASE SAS.
@@ -403,7 +403,7 @@ localization (only if additional content was deployed during the installation pr
403403

404404
--------------------------------------------------------------------
405405

406-
*SAS package generated by SAS Package Framework, version `20240711`*
406+
*SAS package generated by SAS Package Framework, version `20250729`*
407407

408408
--------------------------------------------------------------------
409409

@@ -989,7 +989,12 @@ The QgetVars() returns quoted value [by %superq()].
989989

990990
See examples below for the details.
991991

992-
The `%getVars()` macro executes like a pure macro code.
992+
When `mcArray=` is not used the `%getVars()` macro executes like
993+
a pure macro code. When `mcArray=` is not null (creation of a
994+
macro variable array is requested) them a single semicolon is returned.
995+
996+
When `validvarname=ANY` in set special care should be kept.
997+
See dedicated examples below.
993998

994999
### SYNTAX: ###################################################################
9951000

@@ -1003,6 +1008,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
10031008
<,quote=>
10041009
<,mcArray=>
10051010
<,ignoreCases>
1011+
<,nlit=>
10061012
)
10071013
~~~~~~~~~~~~~~~~~~~~~~~
10081014

@@ -1025,23 +1031,32 @@ The basic syntax is the following, the `<...>` means optional parameters:
10251031

10261032
* `mcArray=` - *Optional*, default value is blank.
10271033
1) When *null* - the macro behaves like a macro function
1028-
and returns a text string with variables list.
1029-
2) When *not null* - behaviour of the macro is altered.
1034+
and ban be used in the `%put` or `%let=` statements.
1035+
The returned text is a string with variables list.
1036+
2) When *not null* - behavior of the macro is altered.
10301037
In such case a macro array of selected variables, named
10311038
with `mcArray` value as a prefix, is created.
10321039
Furthermore a macro named as `mcArray` value is generated.
10331040
(see the macroArray package for the details).
10341041
When `mcArray=` parameter is active the `getVars` macro
1035-
cannot be called within the `%put` statement. Execution like:
1036-
`%put %getVars(..., mcArray=XXX);` will result with
1037-
an Explicit & Radical Refuse Of Run (aka ERROR).
1042+
should not be called within the `%put` or `%let=` statements.
1043+
A single semicolon is produced as the macro result, hence
1044+
execution like: `%put %getVars(..., mcArray=XXX) some text;`
1045+
will result with an Explicit & Radical Refuse Of Run (aka ERROR).
10381046

1039-
* `ignoreCases=` - *Optional*, default value is 1.
1047+
* `ignoreCases=` - *Optional*, default value is 1.
10401048
Indicates if search should be case insensitive.
10411049

1050+
* `nlit=` - *Optional*, default value is 0.
1051+
Introduced to improve `validvarname=ANY` handling.
1052+
Indicates if the `NLITERAL()` function should be
1053+
executed to cover spacial characters.
1054+
10421055

10431056
### EXAMPLES AND USECASES: ####################################################
10441057

1058+
**When `validvarname=` option is _not_ `ANY`.**
1059+
10451060
**EXAMPLE 1.** A list of all variables from the
10461061
sashelp.class dataset:
10471062
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
@@ -1267,6 +1282,44 @@ run;
12671282
%put %do_over(XYZ);
12681283
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
12691284

1285+
**When the `validvarname=ANY` option is set.**
1286+
1287+
**EXAMPLE 12.** Get all variables and handle special characters.
1288+
Without `nlit=1` the code will fail.
1289+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
1290+
options validvarname = any;
1291+
data varnameANY;
1292+
set sashelp.class(obs=3);
1293+
1294+
'A&B'n=42;
1295+
'space name'n=101;
1296+
'2025-08'n=234;
1297+
'2025%09'n=235;
1298+
"2025'10"n=236;
1299+
'2025"11'n=237;
1300+
run;
1301+
1302+
%put %getVars(varnameANY, nlit=1);
1303+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1304+
1305+
**EXAMPLE 13.** Create macro variable array ABC for all variables.
1306+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
1307+
%getVars(varnameANY, mcArray=ABC, nlit=1);
1308+
%put %ABC(1) %ABC(6) %ABC(7) %ABC(11);
1309+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1310+
1311+
**EXAMPLE 14.** Get only variables with illegal characters in names.
1312+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
1313+
%let notV7compliant = %getVars(varnameANY, pattern=[^a-z0-9_], nlit=1);
1314+
%put &notV7compliant.;
1315+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1316+
1317+
1318+
**EXAMPLE 14.** Print variables starting with a digit.
1319+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
1320+
%put %getVars(varnameANY, pattern=^\d, nlit=1);
1321+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1322+
12701323
---
12711324

12721325

@@ -1929,6 +1982,11 @@ The basic syntax is the following, the `<...>` means optional parameters:
19291982
* `ignoreCases=` - *Optional*, default value is 1.
19301983
Indicates if search should be case insensitive.
19311984

1985+
* `nlit=` - *Optional*, default value is 0.
1986+
Introduced to improve `validvarname=ANY` handling.
1987+
Indicates if the `NLITERAL()` function should be
1988+
executed to cover spacial characters.
1989+
19321990

19331991
### EXAMPLES AND USECASES: ####################################################
19341992

@@ -6395,7 +6453,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
63956453

63966454
3. `false` - *Required*, value returned when condition is false.
63976455

6398-
4 `v=` - *Optional*, v for verbose. If set to `1` extra notes
6456+
* `v=` - *Optional*, v for verbose. If set to `1` extra notes
63996457
are printed.
64006458
---
64016459

@@ -7598,7 +7656,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
75987656

75997657
# License <a name="license"></a> ######
76007658

7601-
Copyright (c) 2020 - 2024 Bartosz Jablonski
7659+
Copyright (c) 2020 - 2025 Bartosz Jablonski
76027660

76037661
Permission is hereby granted, free of charge, to any person obtaining a copy
76047662
of this software and associated documentation files (the "Software"), to deal

baseplus.zip

1.27 KB
Binary file not shown.

0 commit comments

Comments
 (0)