Skip to content

Commit

Permalink
Package: bpUTiL, Version: 1.1.0
Browse files Browse the repository at this point in the history
Package: bpUTiL, Version: 1.1.0

- Bug Fix in `%bpUTiL_listNonMissVars()` macro.
- New parameter added to `%bpUTiL_listNonMissVars()` macro.

---

- File SHA256: `F*C5613BE7CC9143BED0C4490A3AFC823913DF20389D1454FA2CBC5E1F96A8DC5A` for this version
- Content SHA256: `C*1038E44579CFB78F8A5EBCA82FB7F624A3DF028736C894C284F0A80D3E8C7BEB` for this version
  • Loading branch information
yabwon committed Jan 26, 2025
1 parent bc66e2f commit de4a4b2
Show file tree
Hide file tree
Showing 5 changed files with 981 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The `bpUTiL` package, supported by `basePlus` and `macroArray` packages,
provides a set of basic popular utility programs to make daily programming
work easier.

SHA256 digest for the latest version of `bpUTiL`: F*390C7CDF54D37027EE50105C0BB26E5908F17B5000190601091A9B5D74055B66
SHA256 digest for the latest version of `bpUTiL`: F*C5613BE7CC9143BED0C4490A3AFC823913DF20389D1454FA2CBC5E1F96A8DC5A

[**Documentation for bpUTiL**](./bputil.md "Documentation for bpUTiL")

Expand Down
189 changes: 135 additions & 54 deletions bputil.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
### Version information:

- Package: bpUTiL
- Version: 1.0.0
- Generated: 2025-01-20T17:19:10
- Version: 1.1.0
- Generated: 2025-01-26T10:12:07
- Author(s): Bartosz Jablonski (yabwon@gmail.com)
- Maintainer(s): Bartosz Jablonski (yabwon@gmail.com)
- License: MIT
- File SHA256: `F*390C7CDF54D37027EE50105C0BB26E5908F17B5000190601091A9B5D74055B66` for this version
- Content SHA256: `C*D859AC256B335E49D7BAFE5CAB89A922BB230B505CA80AC06AC83DB05A885477` for this version
- File SHA256: `F*C5613BE7CC9143BED0C4490A3AFC823913DF20389D1454FA2CBC5E1F96A8DC5A` for this version
- Content SHA256: `C*1038E44579CFB78F8A5EBCA82FB7F624A3DF028736C894C284F0A80D3E8C7BEB` for this version

---

# The `bpUTiL` package, version: `1.0.0`;
# The `bpUTiL` package, version: `1.1.0`;

---

Expand Down Expand Up @@ -55,14 +55,15 @@ The `bpUTiL` package consists of the following content:
3. [`$bputil_listnonmissvars.` format/informat ](#bputillistnonmissvars-formats-3 )
4. [`%bputil_int_1varattrsds1()` macro ](#bputilint1varattrsds1-macro-4 )
5. [`%bputil_int_1varattrsds2()` macro ](#bputilint1varattrsds2-macro-5 )
6. [`%bputil_attributes()` macro ](#bputilattributes-macro-6 )
7. [`%bputil_convertn2c()` macro ](#bputilconvertn2c-macro-7 )
8. [`%bputil_includesasnotebook()` macro ](#bputilincludesasnotebook-macro-8 )
9. [`%bputil_listnonmissvars()` macro ](#bputillistnonmissvars-macro-9 )
10. [`%bputil_varstoonecasesize()` macro ](#bputilvarstoonecasesize-macro-10 )
6. [`%bputil_int_listnonmissvars()` macro ](#bputilintlistnonmissvars-macro-6 )
7. [`%bputil_attributes()` macro ](#bputilattributes-macro-7 )
8. [`%bputil_convertn2c()` macro ](#bputilconvertn2c-macro-8 )
9. [`%bputil_includesasnotebook()` macro ](#bputilincludesasnotebook-macro-9 )
10. [`%bputil_listnonmissvars()` macro ](#bputillistnonmissvars-macro-10 )
11. [`%bputil_varstoonecasesize()` macro ](#bputilvarstoonecasesize-macro-11 )


11. [License note](#license)
12. [License note](#license)

---

Expand Down Expand Up @@ -112,7 +113,16 @@ Dedicated for `PROC DS2` format.

---

## `%bputil_attributes()` macro <a name="bputilattributes-macro-6"></a> ######
## `%bputil_int_listnonmissvars()` macro <a name="bputilintlistnonmissvars-macro-6"></a> ######
An internal macro for *exclusive* use inside `%bpUTiL_listNonMissVars()` macro.

Lists data set's variables name, their type, and checks if not missing.

---

---

## `%bputil_attributes()` macro <a name="bputilattributes-macro-7"></a> ######

### DESCRIPTION: ##############################################################

Expand Down Expand Up @@ -261,7 +271,7 @@ quit;

---

## `%bputil_convertn2c()` macro <a name="bputilconvertn2c-macro-7"></a> ######
## `%bputil_convertn2c()` macro <a name="bputilconvertn2c-macro-8"></a> ######

### DESCRIPTION: ##############################################################

Expand Down Expand Up @@ -401,7 +411,7 @@ run;

---

## `%bputil_includesasnotebook()` macro <a name="bputilincludesasnotebook-macro-8"></a> ######
## `%bputil_includesasnotebook()` macro <a name="bputilincludesasnotebook-macro-9"></a> ######

### DESCRIPTION: ##############################################################

Expand Down Expand Up @@ -507,7 +517,7 @@ The basic syntax is the following, the `<...>` means optional parameters:

---

## `%bputil_listnonmissvars()` macro <a name="bputillistnonmissvars-macro-9"></a> ######
## `%bputil_listnonmissvars()` macro <a name="bputillistnonmissvars-macro-10"></a> ######

### DESCRIPTION: ##############################################################

Expand Down Expand Up @@ -536,39 +546,46 @@ The basic syntax is the following, the `<...>` means optional parameters:
<,print=>
<,list=>
<,putlog=>
<,condition=>
)
~~~~~~~~~~~~~~~~~~~~~~~

**Arguments description**:

1. `ds` - *Required.* Valid data set name.
No data set options can be used.

* `out=` - *Optional.* Name of a data sets to store
produced list of variables.
Default value is: `WORK.anyNonMissingData`.
When `print=` or `list=` are used the data
set is not created.


* `print=` - *Optional.* Indicates if the list of variables
should be stored as a SAS data set (`print=0`) or
the list should be return in "function-like"
style (`print=1`).
`Print=` is an alias to `list=`.
Default value is `0`

* `list=` - *Optional.* Indicates the if list of variables
should be stored as a SAS data set (`list=0`) or
the list should be return in "function-like"
style (`list=1`).
`List=` is an alias to `print=`.
Default value is `0`

* `putlog=` - *Optional.* Indicates if the list of variables
should also displayed in the SAS LOG.
Default value is `0` and means "do not print".

1. `ds` - *Required.* Valid data set name.
No data set options can be used.

* `out=` - *Optional.* Name of a data sets to store
produced list of variables.
Default value is: `WORK.anyNonMissingData`.
When `print=` or `list=` are used the data
set is not created.

* `print=` - *Optional.* Indicates if the list of variables
should be stored as a SAS data set (`print=0`) or
the list should be return in "function-like"
style (`print=1`).
`Print=` is an alias to `list=`.
Default value is `0`

* `list=` - *Optional.* Indicates the if list of variables
should be stored as a SAS data set (`list=0`) or
the list should be return in "function-like"
style (`list=1`).
`List=` is an alias to `print=`.
Default value is `0`

* `putlog=` - *Optional.* Indicates if the list of variables
should also displayed in the SAS LOG.
Default value is `0` and means "do not print".

* `condition=` - *Optional.* Allows for manual filtering the number of
non missing values to select a variable.
Default value is `NE 0` and means "select variables
with at least one non missing value".
Example values: `EQ 0` - "select 100% missing variables",
`GT 20` - "select variables with at least 21 non missing values"

---


Expand Down Expand Up @@ -598,47 +615,111 @@ run;
proc print data = anyNonMissingData;
run;
%bpUTiL_listNonMissVars(haveC)
proc print data = anyNonMissingData;
%bpUTiL_listNonMissVars(haveC,out=allMissingData,condition=EQ 0)
proc print data = allMissingData;
run;
%put %bpUTiL_listNonMissVars(haveC,print=1);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**EXAMPLE 2.** Use macro to exclude empty variables:
**EXAMPLE 2.** Use macro to keep non-empty variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data have1;
data have1k;
infile cards dlm="|" dsd;
input a $ b $ c d e $ f;
cards;
z||.|26||.
a||.|1|a|1
b||.|2| |.
c||.|3|c|3
d||.|4| |.
run;
proc print data = have1;
proc print data = have1k;
run;
%bpUTiL_listNonMissVars(have1,out=WORK.anyNonMissingData1)
%bpUTiL_listNonMissVars(have1k,out=WORK.anyNonMissingData1)
proc print data = anyNonMissingData1;
run;
%put %bpUTiL_listNonMissVars(have1,list=1,putlog=1);
%put %bpUTiL_listNonMissVars(have1k,list=1,putlog=1);
data want1k;
set have1k(keep = %bpUTiL_listNonMissVars(have1k,list=1));
run;
proc print data = want1k;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

**EXAMPLE 3.** Use macro to drop empty variables:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data have1d;
infile cards dlm="|" dsd;
input a $ b $ c d e $ f;
cards;
z||.|26||.
a||.|1|a|1
b||.|2| |.
c||.|3|c|3
d||.|4| |.
run;
proc print data = have1d;
run;
%bpUTiL_listNonMissVars(have1d,out=WORK.allMissingData1,condition=EQ 0)
proc print data = allMissingData1;
run;
%put %bpUTiL_listNonMissVars(have1d,list=1,putlog=1,condition=EQ 0);
data want1;
set have1(keep = %bpUTiL_listNonMissVars(have1,list=1));
data want1d;
set have1d(drop = %bpUTiL_listNonMissVars(have1d,list=1,putlog=1,condition=EQ 0));
run;
proc print data = want1;
proc print data = want1d;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



**EXAMPLE 4.** Use macro to select only certain amount (`> 2`) of nonmissing:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
data have1c;
infile cards dlm="|" dsd;
input a $ b $ c d e $ f;
cards;
z||.|26||.
a||.|1|a|1
b||.|2| |.
c||.|3|c|3
d||.|4| |.
run;
proc print data = have1c;
run;
%bpUTiL_listNonMissVars(have1c,out=WORK.moreThan2nonMissingData,condition=GT 2)
proc print data = moreThan2nonMissingData;
run;
%put %bpUTiL_listNonMissVars(have1c,list=1,putlog=1,condition=GT 2);
data want1c;
set have1c(keep = %bpUTiL_listNonMissVars(have1c,list=1,putlog=1,condition=GT 2));
run;
proc print data = want1c;
run;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---


---

## `%bputil_varstoonecasesize()` macro <a name="bputilvarstoonecasesize-macro-10"></a> ######
## `%bputil_varstoonecasesize()` macro <a name="bputilvarstoonecasesize-macro-11"></a> ######

### DESCRIPTION: ##############################################################

Expand Down
Binary file modified bputil.zip
Binary file not shown.
Loading

0 comments on commit de4a4b2

Please sign in to comment.