9
9
### Version information:
10
10
11
11
- Package: bpUTiL
12
- - Version: 0.1.1
13
- - Generated: 2024-12-05T21:07 :10
12
+ - Version: 1.0.0
13
+ - Generated: 2025-01-20T17:19 :10
14
14
- Author(s): Bartosz Jablonski (
[email protected] )
15
15
- Maintainer(s): Bartosz Jablonski (
[email protected] )
16
16
- License: MIT
17
- - File SHA256: ` F*2513DA82048CB4470624B219012D30B873560A6BD4D1C515E3A462CF0E316445 ` for this version
18
- - Content SHA256: ` C*96ADFF959697C27D1A46BC93B5C8E6C095908ECE0142ADF9F0F42266A47B8236 ` for this version
17
+ - File SHA256: ` F*390C7CDF54D37027EE50105C0BB26E5908F17B5000190601091A9B5D74055B66 ` for this version
18
+ - Content SHA256: ` C*D859AC256B335E49D7BAFE5CAB89A922BB230B505CA80AC06AC83DB05A885477 ` for this version
19
19
20
20
---
21
21
22
- # The ` bpUTiL ` package, version: ` 0.1.1 ` ;
22
+ # The ` bpUTiL ` package, version: ` 1.0.0 ` ;
23
23
24
24
---
25
25
@@ -43,7 +43,7 @@ Required SAS Packages:
43
43
44
44
--------------------------------------------------------------------
45
45
46
- * SAS package generated by SAS Package Framework, version ` 20241129 ` *
46
+ * SAS package generated by SAS Package Framework, version ` 20241207 ` *
47
47
48
48
--------------------------------------------------------------------
49
49
@@ -52,15 +52,17 @@ The `bpUTiL` package consists of the following content:
52
52
53
53
1 . [ ` bputil_int_oneliners ` exec ] ( #bputilintoneliners-exec-1 )
54
54
2 . [ ` bputil_int_oneliners ` clean ] ( #bputilintoneliners-clean-2 )
55
- 3 . [ ` %bputil_int_1varattrsds1() ` macro ] ( #bputilint1varattrsds1-macro-3 )
56
- 4 . [ ` %bputil_int_1varattrsds2() ` macro ] ( #bputilint1varattrsds2-macro-4 )
57
- 5 . [ ` %bputil_attributes() ` macro ] ( #bputilattributes-macro-5 )
58
- 6 . [ ` %bputil_convertn2c() ` macro ] ( #bputilconvertn2c-macro-6 )
59
- 7 . [ ` %bputil_includesasnotebook() ` macro ] ( #bputilincludesasnotebook-macro-7 )
60
- 8 . [ ` %bputil_varstoonecasesize() ` macro ] ( #bputilvarstoonecasesize-macro-8 )
55
+ 3 . [ ` $bputil_listnonmissvars. ` format/informat ] ( #bputillistnonmissvars-formats-3 )
56
+ 4 . [ ` %bputil_int_1varattrsds1() ` macro ] ( #bputilint1varattrsds1-macro-4 )
57
+ 5 . [ ` %bputil_int_1varattrsds2() ` macro ] ( #bputilint1varattrsds2-macro-5 )
58
+ 6 . [ ` %bputil_attributes() ` macro ] ( #bputilattributes-macro-6 )
59
+ 7 . [ ` %bputil_convertn2c() ` macro ] ( #bputilconvertn2c-macro-7 )
60
+ 8 . [ ` %bputil_includesasnotebook() ` macro ] ( #bputilincludesasnotebook-macro-8 )
61
+ 9 . [ ` %bputil_listnonmissvars() ` macro ] ( #bputillistnonmissvars-macro-9 )
62
+ 10 . [ ` %bputil_varstoonecasesize() ` macro ] ( #bputilvarstoonecasesize-macro-10 )
61
63
62
64
63
- 9 . [ License note] ( #license )
65
+ 11 . [ License note] ( #license )
64
66
65
67
---
66
68
@@ -84,23 +86,33 @@ Cleaning internal "one-liners" built with BasePlus `%GenerateOneLiners()` macro.
84
86
85
87
---
86
88
87
- ## ` %bputil_int_1varattrsds1() ` macro <a name =" bputilint1varattrsds1-macro-3 " ></a > ######
89
+ ## ` $bputil_listnonmissvars. ` format/informat <a name =" bputillistnonmissvars-formats-3 " ></a > ######
90
+ Both formats are internal for use of ` %bpUTiL_listNonMissVars() ` macro.
91
+
92
+ Both display missing value as a blank space (` " " ` ) and any
93
+ non-missing value as asterisk (` "*" ` ).
94
+
95
+ ---
96
+
97
+ ---
98
+
99
+ ## ` %bputil_int_1varattrsds1() ` macro <a name =" bputilint1varattrsds1-macro-4 " ></a > ######
88
100
An internal macro to extract attributes information about ` i ` -th variable
89
101
from an ` open() ` data set with identifier ` dsid ` .
90
102
91
103
Dedicated for ` DATA STEP ` format.
92
104
93
105
---
94
106
95
- ## ` %bputil_int_1varattrsds2() ` macro <a name =" bputilint1varattrsds2-macro-4 " ></a > ######
107
+ ## ` %bputil_int_1varattrsds2() ` macro <a name =" bputilint1varattrsds2-macro-5 " ></a > ######
96
108
An internal macro to extract attributes information about ` i ` -th variable
97
109
from an ` open() ` data set with identifier ` dsid ` .
98
110
99
111
Dedicated for ` PROC DS2 ` format.
100
112
101
113
---
102
114
103
- ## ` %bputil_attributes() ` macro <a name =" bputilattributes-macro-5 " ></a > ######
115
+ ## ` %bputil_attributes() ` macro <a name =" bputilattributes-macro-6 " ></a > ######
104
116
105
117
### DESCRIPTION: ##############################################################
106
118
@@ -249,7 +261,7 @@ quit;
249
261
250
262
---
251
263
252
- ## ` %bputil_convertn2c() ` macro <a name =" bputilconvertn2c-macro-6 " ></a > ######
264
+ ## ` %bputil_convertn2c() ` macro <a name =" bputilconvertn2c-macro-7 " ></a > ######
253
265
254
266
### DESCRIPTION: ##############################################################
255
267
389
401
390
402
---
391
403
392
- ## ` %bputil_includesasnotebook() ` macro <a name =" bputilincludesasnotebook-macro-7 " ></a > ######
404
+ ## ` %bputil_includesasnotebook() ` macro <a name =" bputilincludesasnotebook-macro-8 " ></a > ######
393
405
394
406
### DESCRIPTION: ##############################################################
395
407
@@ -495,7 +507,138 @@ The basic syntax is the following, the `<...>` means optional parameters:
495
507
496
508
---
497
509
498
- ## ` %bputil_varstoonecasesize() ` macro <a name =" bputilvarstoonecasesize-macro-8 " ></a > ######
510
+ ## ` %bputil_listnonmissvars() ` macro <a name =" bputillistnonmissvars-macro-9 " ></a > ######
511
+
512
+ ### DESCRIPTION: ##############################################################
513
+
514
+ The ` bpUTiL_listNonMissVars() ` macro allow for automatic listing of
515
+ variables that have at least one non-missing value.
516
+
517
+ Macro behaves in two possible ways:
518
+ 1 ) result can be stored a SAS data set (parameter ` out= ` ), or
519
+ 2 ) macro prints a list of values in a "function-like" style (parameter ` list= ` ).
520
+
521
+ Behaviors are exclusive, i.e., you can select only 1) or 2) for a single
522
+ macro call.
523
+
524
+ Idea for the macro was inspired by SAS communities post:
525
+ https://communities.sas.com/t5/SAS-Programming/How-to-find-out-if-all-the-values-of-a-variable-numeric-or/m-p/931919#M366632
526
+
527
+ Macro executes as pure macro code.
528
+
529
+ ### SYNTAX: ###################################################################
530
+
531
+ The basic syntax is the following, the ` <...> ` means optional parameters:
532
+ ~~~~~~~~~~~~~~~~~~~~~~~ sas
533
+ %bpUTiL_listNonMissVars(
534
+ ds
535
+ <,out=>
536
+ <,print=>
537
+ <,list=>
538
+ <,putlog=>
539
+ )
540
+ ~~~~~~~~~~~~~~~~~~~~~~~
541
+
542
+ ** Arguments description** :
543
+
544
+ 1 . ` ds ` - * Required.* Valid data set name.
545
+ No data set options can be used.
546
+
547
+ * ` out= ` - * Optional.* Name of a data sets to store
548
+ produced list of variables.
549
+ Default value is: ` WORK.anyNonMissingData ` .
550
+ When ` print= ` or ` list= ` are used the data
551
+ set is not created.
552
+
553
+
554
+ * ` print= ` - * Optional.* Indicates if the list of variables
555
+ should be stored as a SAS data set (` print=0 ` ) or
556
+ the list should be return in "function-like"
557
+ style (` print=1 ` ).
558
+ ` Print= ` is an alias to ` list= ` .
559
+ Default value is ` 0 `
560
+
561
+ * ` list= ` - * Optional.* Indicates the if list of variables
562
+ should be stored as a SAS data set (` list=0 ` ) or
563
+ the list should be return in "function-like"
564
+ style (` list=1 ` ).
565
+ ` List= ` is an alias to ` print= ` .
566
+ Default value is ` 0 `
567
+
568
+ * ` putlog= ` - * Optional.* Indicates if the list of variables
569
+ should also displayed in the SAS LOG.
570
+ Default value is ` 0 ` and means "do not print".
571
+
572
+ ---
573
+
574
+
575
+ ### EXAMPLES AND USECASES: ####################################################
576
+
577
+ ** EXAMPLE 1.** Basic use case:
578
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sas
579
+ %let size=20;
580
+ data have haveN(keep=_numeric_) haveC(keep=_character_);
581
+ ffffffffffffffffffffffffffffffff = "F";
582
+ gggggggggggggggggggggggggggggggg = 123;
583
+ array MissC[&size.] $1 ;
584
+ array noMissC[&size.] $1 (&size.*"A");
585
+ array MissN[&size.] ;
586
+ array noMissN[&size.] (&size.* 1 );
587
+ do i = 1 to 5e5;
588
+ output;
589
+ end;
590
+ drop i;
591
+ run;
592
+
593
+ %bpUTiL_listNonMissVars(have,putlog=1)
594
+ proc print data = anyNonMissingData;
595
+ run;
596
+
597
+ %bpUTiL_listNonMissVars(haveN)
598
+ proc print data = anyNonMissingData;
599
+ run;
600
+
601
+ %bpUTiL_listNonMissVars(haveC)
602
+ proc print data = anyNonMissingData;
603
+ run;
604
+ %put %bpUTiL_listNonMissVars(haveC,print=1);
605
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
606
+
607
+ ** EXAMPLE 2.** Use macro to exclude empty variables:
608
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sas
609
+ data have1;
610
+ infile cards dlm="|" dsd;
611
+ input a $ b $ c d e $ f;
612
+ cards;
613
+ a||.|1|a|1
614
+ b||.|2| |.
615
+ c||.|3|c|3
616
+ d||.|4| |.
617
+ run;
618
+
619
+ proc print data = have1;
620
+ run;
621
+
622
+ %bpUTiL_listNonMissVars(have1,out=WORK.anyNonMissingData1)
623
+ proc print data = anyNonMissingData1;
624
+ run;
625
+
626
+ %put %bpUTiL_listNonMissVars(have1,list=1,putlog=1);
627
+
628
+ data want1;
629
+ set have1(keep = %bpUTiL_listNonMissVars(have1,list=1));
630
+ run;
631
+
632
+ proc print data = want1;
633
+ run;
634
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
635
+
636
+ ---
637
+
638
+
639
+ ---
640
+
641
+ ## ` %bputil_varstoonecasesize() ` macro <a name =" bputilvarstoonecasesize-macro-10 " ></a > ######
499
642
500
643
### DESCRIPTION: ##############################################################
501
644
0 commit comments