Compare commits

..

37 Commits

Author SHA1 Message Date
yabwon
a6cfb9f93f Getting Started with SAS Packages
Recompiled with new version of SAS Packages Framework.
2020-08-11 16:54:45 +02:00
yabwon
63b30d7b6e version 0.3
Recompiled with new version of SAS Packages Framework.
2020-08-11 16:54:08 +02:00
yabwon
eef8649f3c version 0.2
Recompiled with new version of SAS Packages Framework.
2020-08-11 16:53:57 +02:00
yabwon
4511c812f0 version 2.1
Recompiled with new version of SAS Packages Framework.
2020-08-11 16:53:28 +02:00
yabwon
5ca878d178 version 0.52
Recompiled with new version of SAS Packages Framework.
2020-08-11 16:53:18 +02:00
yabwon
5c042cadff Merge branch 'master' of https://github.com/yabwon/SAS_PACKAGES 2020-08-11 16:44:43 +02:00
yabwon
3eb09f29cd version 20200811
version 20200811, changes:
- in the %generatePackage() macro the filesLocation is now positional parameter (the first one),
- in the framework both `%loadPackage()` and %loadPackage(HELP)` command prints out the help information for the %loadPackage() macro,
- the %ICEloadPackage() macro extended with version testing,
- test for existence of %loadpackage macro added,
- bug fix in lazyData generation
- documentation updated.
2020-08-11 16:44:38 +02:00
yabwon
da3c8df259 Getting Started with SAS Packages
Recompiled with new version of SAS Packages Framework.
2020-08-11 15:10:33 +02:00
yabwon
b9fa8fc5d7 version 2.1
Recompiled with new version of SAS Packages Framework.
2020-08-11 15:08:44 +02:00
yabwon
1fda328de8 version 0.3
Recompiled with new version of SAS Packages Framework.
2020-08-11 15:08:16 +02:00
yabwon
322a951290 version 0.2
Recompiled with new version of SAS Packages Framework.
2020-08-11 15:07:55 +02:00
yabwon
b090fdbe8d version 0.52
Recompiled with new version of SAS Packages Framework.
2020-08-11 15:07:17 +02:00
yabwon
42663d56f7 version 20200811
version 20200811, changes:
- in the %generatePackage() macro the filesLocation is now positional parameter (the first one),
- in the framework both `%loadPackage()` and %loadPackage(HELP)` command prints out the help information for the %loadPackage() macro,
- bug fix in lazyData generation
- documentation updated.
2020-08-11 14:47:41 +02:00
yabwon
bed882582e version 20200811 2020-08-11 12:34:49 +02:00
yabwon
532f1ec90e version 20200811
version 20200811, changes:
- in the %generatePackage() macro the filesLocation is now positional parameter (the first one),
- in the framework both `%loadPackage()` and %loadPackage(HELP)` command prints out the help information for the %loadPackage() macro,
- documentation updated.
2020-08-11 12:34:10 +02:00
yabwon
861c5d866b Getting Started with SAS Packages
BasePlus v0.52 recompiled
2020-08-10 14:55:10 +02:00
yabwon
f22d06fb42 version 20200810 2020-08-10 14:54:10 +02:00
yabwon
c0212cb8af version 0.52
recompiled with the new framework
2020-08-10 14:53:27 +02:00
yabwon
4ae8f23716 version 20200810
Version 20200810.
Parsing of the `description.sas` file improved.
Documentation corrected.
2020-08-10 14:52:47 +02:00
yabwon
7fd4dd9774 Getting Started with SAS Packages
BasePlus v0.52
2020-08-07 13:03:03 +02:00
yabwon
f41d73cd90 version 20200708 2020-08-07 13:02:08 +02:00
yabwon
863d6cb251 version 0.52
Help info added: "Caution! Array parameters to subroutine calls must be 1-based."

Spelling correction.
2020-08-07 13:00:52 +02:00
yabwon
790816e229 version 20200807
Framework:
Code searching help tags simplified.

Documentation:
Clarification about "description.sas" added.
2020-08-07 12:58:50 +02:00
yabwon
88ace7321b version 20200803
20200803
2020-08-05 12:29:31 +02:00
yabwon
f4ac0f1fe3 version 20200803
help info for %listPackages() added
2020-08-05 12:27:08 +02:00
yabwon
eb5cd6975c Getting Started with SAS Packages
presentation: "Getting Started with SAS Packages" added
2020-08-04 13:04:29 +02:00
yabwon
b975f75ff3 Getting Started with SAS Packages
presentation: "Getting Started with SAS Packages" added
2020-08-04 10:37:40 +02:00
yabwon
bb22a3e274 Getting Started with SAS Packages
Getting Started with SAS Packages
2020-08-04 10:33:14 +02:00
yabwon
f981751c28 Getting Started with SAS Packages
Getting Started with SAS Packages
2020-08-04 10:30:19 +02:00
yabwon
2f110adf1f Getting Started with SAS Packages
presentation: "Getting Started with SAS Packages" added
2020-08-04 10:19:55 +02:00
yabwon
5b1f8a3aae Getting Started with SAS Packages
presentation: "Getting Started with SAS Packages" added
2020-08-04 10:18:04 +02:00
yabwon
ef6473ad35 link to the doc added
link to the doc added
2020-08-04 10:14:43 +02:00
yabwon
e30261410e obsolete
obsolete
2020-08-04 07:17:31 +02:00
yabwon
3ede4541fd version 20200803
version 20200803, some code simplifications
2020-08-03 13:56:18 +02:00
yabwon
387898e01a version 20200730
Adjusted to SPF v.20200730
2020-07-31 22:20:10 +02:00
yabwon
e801f99e1c version 20200730
version 20200730, change list:

1) All elements of the SAS Packages Framework were moved to the SPFinit.sas file in directory SPF [SAS Packages Framework].

2) The public repository reordered [two new folders] and location link in the %installPackages() macro changed.

3) New directories: SPF [for SAS Packages Framework content and documentation] and packages [for packages repository]

4) Package FunctionsImissinBASE renamed to BasePlus.

5) All packages recompiled with new setup.

6) Help info improved and spellings corrected.
2020-07-31 14:43:40 +02:00
yabwon
850e003ea9 folder name corrected
folder name corrected
2020-07-31 11:34:06 +02:00
11 changed files with 400 additions and 171 deletions

View File

@@ -6,13 +6,15 @@ A **SAS package** is an automatically generated, single, stand alone *zip* file
The *purpose of a package* is to be a simple, and easy to access, code sharing medium, which will allow: on the one hand, to separate the code complex dependencies created by the developer from the user experience with the final product and, on the other hand, reduce developer's and user's unnecessary frustration related to a remote deployment process. The *purpose of a package* is to be a simple, and easy to access, code sharing medium, which will allow: on the one hand, to separate the code complex dependencies created by the developer from the user experience with the final product and, on the other hand, reduce developer's and user's unnecessary frustration related to a remote deployment process.
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is `20200730`. In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is `20200811`.
Read the **`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`** to learn more (see the `./SPF/Documentation` directory). To get started with SAS Packages try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/master/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
The documentation and more advance reading would be the [**`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`**](https://github.com/yabwon/SAS_PACKAGES/blob/master/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") article (see the `./SPF/Documentation` directory).
**General overview video:** **General overview video:**
- SAS Global Forum 2020 V.E.: `https://www.youtube.com/watch?v=qCkb-bx0Dv8&t=0s` - [SAS Global Forum 2020 V.E.](https://www.youtube.com/watch?v=qCkb-bx0Dv8&t=0s "SGF2020")
- Sasensei Internationa Dojo: `https://www.youtube.com/watch?v=BFhdUBQgjYQ&t=0s` - [Sasensei Internationa Dojo](https://www.youtube.com/watch?v=BFhdUBQgjYQ&t=0s "SID no. 1")
### The User: ### The User:
To use a package: To use a package:
@@ -45,12 +47,12 @@ filename SPFinit url "https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/mast
%loadPackage(packageName) /* load the package content into the SAS session */ %loadPackage(packageName) /* load the package content into the SAS session */
``` ```
**Workshop video for the User**\[May 6th, 2020\]**: `https://youtu.be/qX_-HJ76g8Y`** [a bit outdated but gives the idea how it works] [**Workshop video for the User**](https://youtu.be/qX_-HJ76g8Y)\[May 6th, 2020\] [a bit outdated but gives the idea how it works]
### The Developer: ### The Developer:
To create your own package: To create your own package:
- Read the **`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`** to learn more details. - Read the [**`SAS(r) packages - the way to share (a how to)- Paper 4725-2020 - extended.pdf`**](https://github.com/yabwon/SAS_PACKAGES/blob/master/SPF/Documentation/SAS(r)%20packages%20-%20the%20way%20to%20share%20(a%20how%20to)-%20Paper%204725-2020%20-%20extended.pdf "SAS packages - the way to share") to learn more details.
- Download and use the `SPFinit.sas` file (the SAS Packages Framework) file (user part of the framework required for *testing* is there too). - Download and use the `SPFinit.sas` file (the SAS Packages Framework), the part of the framework required for *testing* is there too.
#### If you have any questions, suggestions, or ideas do not hesitate to contact me! #### If you have any questions, suggestions, or ideas do not hesitate to contact me!
@@ -86,7 +88,7 @@ run;
%end; %end;
``` ```
- **BasePlus**\[0.5\] adds a bunch of functionalities I am missing in BASE SAS, such as: - **BasePlus**\[0.52\] adds a bunch of functionalities I am missing in BASE SAS, such as:
``` ```
call arrMissToRight(myArray); call arrMissToRight(myArray);
call arrFillMiss(17, myArray); call arrFillMiss(17, myArray);

View File

@@ -42,11 +42,11 @@
- to unload, or - to unload, or
- to generate SAS packages. - to generate SAS packages.
Version 20200730. Version 20200811.
See examples below. See examples below.
A SAS package is a zip file containing a group of files A SAS package is a zip file containing a group of files
with SAS code (macros, functions, datasteps generating with SAS code (macros, functions, data steps generating
data, etc.) wrapped up together and %INCLUDEed by data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip). a single load.sas file (also embedded inside the zip).
*/ */
@@ -62,7 +62,7 @@
, path = %sysfunc(pathname(packages)) /* location of a package, , path = %sysfunc(pathname(packages)) /* location of a package,
by default it looks for by default it looks for
location of "packages" fileref */ location of "packages" fileref */
, options = %str(LOWCASE_MEMNAME) /* posible options for ZIP filename */ , options = %str(LOWCASE_MEMNAME) /* possible options for ZIP filename */
, source2 = /*source2*/ /* option to print out details, , source2 = /*source2*/ /* option to print out details,
null by default */ null by default */
, requiredVersion = . /* option to test if loaded package , requiredVersion = . /* option to test if loaded package
@@ -74,29 +74,38 @@
means "load all datasets" */ means "load all datasets" */
, zip = zip /* standard package is zip (lowcase), , zip = zip /* standard package is zip (lowcase),
e.g. %loadPackage(PiPackage) e.g. %loadPackage(PiPackage)
if the zip is not avaliable use a folder if the zip is not available use a folder
unpack data to "pipackage.disk" folder unpack data to "pipackage.disk" folder
and use loadPackage in the form: and use loadPackage in the form:
%loadPackage(PiPackage, zip=disk, options=) %loadPackage(PiPackage, zip=disk, options=)
*/ */
)/secure )/secure
/*** HELP END ***/ /*** HELP END ***/
des = 'Macro to load SAS package, version 20200730. Run %loadPackage() for help info.' des = 'Macro to load SAS package, version 20200811. Run %loadPackage() for help info.'
; ;
%if %superq(packageName) = %then %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do; %do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ; %put ;
%put ###############################################################################; %put ###############################################################################;
%put # This is short help information for the loadPackage macro #; %put # This is short help information for the loadPackage macro #;
%put ###############################################################################; %put ###############################################################################;
%put # #; %put # #;
%put # Macro to load SAS packages, version 20200730 #; %put # Macro to load SAS packages, version 20200811 #;
%put # #; %put # #;
%put # A SAS package is a zip file containing a group #; %put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, datasteps generating #; %put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #; %put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #; %put # a single load.sas file (also embedded inside the zip). #;
%put # #; %put # #;
%put # The %nrstr(%%loadPackage()) macro loads package content, i.e. macros, #;
%put # functions, formats, etc., from the zip into the SAS session. #;
%put # #;
%put # Parameters: #; %put # Parameters: #;
%put # #; %put # #;
%put # packageName Name of a package, e.g. myPackage, #; %put # packageName Name of a package, e.g. myPackage, #;
@@ -108,7 +117,7 @@ des = 'Macro to load SAS package, version 20200730. Run %loadPackage() for help
%put # location of the "packages" fileref, i.e. #; %put # location of the "packages" fileref, i.e. #;
%put # %nrstr(%%sysfunc(pathname(packages))) #; %put # %nrstr(%%sysfunc(pathname(packages))) #;
%put # #; %put # #;
%put # options= Posible options for ZIP filename, #; %put # options= Possible options for ZIP filename, #;
%put # default value: LOWCASE_MEMNAME #; %put # default value: LOWCASE_MEMNAME #;
%put # #; %put # #;
%put # source2= Option to print out details, null by default. #; %put # source2= Option to print out details, null by default. #;
@@ -120,18 +129,43 @@ des = 'Macro to load SAS package, version 20200730. Run %loadPackage() for help
%put # lazyData= A list of names of lazy datasets to be loaded. #; %put # lazyData= A list of names of lazy datasets to be loaded. #;
%put # If not null datasets from the list are loaded #; %put # If not null datasets from the list are loaded #;
%put # instead of the package. #; %put # instead of the package. #;
%put # Asterisk (*) means "load all datasets". #; %put # Asterisk (*) means "load all lazy datasets". #;
%put # #; %put # #;
%put # zip=zip Standard package is zip (lowcase), #; %put # zip=zip Standard package is zip (lowcase), #;
%put # e.g. %nrstr(%%loadPackage(PiPackage)). #; %put # e.g. %nrstr(%%loadPackage(PiPackage)). #;
%put # If the zip is not avaliable use a folder. #; %put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #; %put # Unpack data to "pipackage.disk" folder #;
%put # and use loadPackage in the following form: #; %put # and use loadPackage in the following form: #;
%put # %nrstr(%%loadPackage(PiPackage, zip=disk, options=)) #; %put # %nrstr(%%loadPackage(PiPackage, zip=disk, options=)) #;
%put # #; %put # #;
%put ###############################################################################; %put ###############################################################################;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to learn more. #;
%put # #;
%put # Example #####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS package from the Internet. #;
%put # #;
%put # Assume that the SPFinit.sas file #;
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ; %put ;
%GOTO ENDloadPackage; %put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put %nrstr( %%unloadPackage(SQLinDS) %%* unload the package content from the SAS session; );
%put ;
%put ###############################################################################;
%put ;
options &options_tmp.;
%RETURN;
%end; %end;
%local ls_tmp ps_tmp notes_tmp source_tmp fullstimer_tmp stimer_tmp msglevel_tmp; %local ls_tmp ps_tmp notes_tmp source_tmp fullstimer_tmp stimer_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls)); %let ls_tmp = %sysfunc(getoption(ls));
@@ -185,9 +219,6 @@ des = 'Macro to load SAS package, version 20200730. Run %loadPackage() for help
&notes_tmp. &source_tmp. &notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp. &stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp.; msglevel=&msglevel_tmp.;
/* jump here after running %loadPackage() - only help is displayed */
%ENDloadPackage:
%mend loadPackage; %mend loadPackage;
/*** HELP START ***/ /*** HELP START ***/
@@ -204,29 +235,38 @@ des = 'Macro to load SAS package, version 20200730. Run %loadPackage() for help
null by default */ null by default */
, zip = zip /* standard package is zip (lowcase), , zip = zip /* standard package is zip (lowcase),
e.g. %unloadPackage(PiPackage) e.g. %unloadPackage(PiPackage)
if the zip is not avaliable use a folder if the zip is not available use a folder
unpack data to "pipackage.disk" folder unpack data to "pipackage.disk" folder
and use unloadPackage in the form: and use unloadPackage in the form:
%unloadPackage(PiPackage, zip=disk, options=) %unloadPackage(PiPackage, zip=disk, options=)
*/ */
)/secure )/secure
/*** HELP END ***/ /*** HELP END ***/
des = 'Macro to unload SAS package, version 20200730. Run %unloadPackage() for help info.' des = 'Macro to unload SAS package, version 20200811. Run %unloadPackage() for help info.'
; ;
%if %superq(packageName) = %then %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do; %do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ; %put ;
%put ###############################################################################; %put ###############################################################################;
%put # This is short help information for the unloadPackage macro #; %put # This is short help information for the unloadPackage macro #;
%put ###############################################################################; %put ###############################################################################;
%put # #; %put # #;
%put # Macro to unload SAS packages, version 20200730 #; %put # Macro to unload SAS packages, version 20200811 #;
%put # #; %put # #;
%put # A SAS package is a zip file containing a group #; %put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, datasteps generating #; %put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #; %put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #; %put # a single load.sas file (also embedded inside the zip). #;
%put # #; %put # #;
%put # The %nrstr(%%unloadPackage()) macro clears the package content #;
%put # from the SAS session. #;
%put # #;
%put # Parameters: #; %put # Parameters: #;
%put # #; %put # #;
%put # packageName Name of a package, e.g. myPackage, #; %put # packageName Name of a package, e.g. myPackage, #;
@@ -238,21 +278,46 @@ des = 'Macro to unload SAS package, version 20200730. Run %unloadPackage() for h
%put # location of the "packages" fileref, i.e. #; %put # location of the "packages" fileref, i.e. #;
%put # %nrstr(%%sysfunc(pathname(packages))) #; %put # %nrstr(%%sysfunc(pathname(packages))) #;
%put # #; %put # #;
%put # options= Posible options for ZIP filename, #; %put # options= Possible options for ZIP filename, #;
%put # default value: LOWCASE_MEMNAME #; %put # default value: LOWCASE_MEMNAME #;
%put # #; %put # #;
%put # source2= Option to print out details, null by default. #; %put # source2= Option to print out details, null by default. #;
%put # #; %put # #;
%put # zip=zip Standard package is zip (lowcase), #; %put # zip=zip Standard package is zip (lowcase), #;
%put # e.g. %nrstr(%%unloadPackage(PiPackage)). #; %put # e.g. %nrstr(%%unloadPackage(PiPackage)). #;
%put # If the zip is not avaliable use a folder. #; %put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #; %put # Unpack data to "pipackage.disk" folder #;
%put # and use loadPackage in the following form: #; %put # and use loadPackage in the following form: #;
%put # %nrstr(%%unloadPackage(PiPackage, zip=disk, options=)) #; %put # %nrstr(%%unloadPackage(PiPackage, zip=disk, options=)) #;
%put # #; %put # #;
%put ###############################################################################; %put ###############################################################################;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to learn more. #;
%put # #;
%put # Example #####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS package from the Internet. #;
%put # #;
%put # Assume that the SPFinit.sas file #;
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ; %put ;
%GOTO ENDunloadPackage; %put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put %nrstr( %%unloadPackage(SQLinDS) %%* unload the package content from the SAS session; );
%put ;
%put ###############################################################################;
%put ;
options &options_tmp.;
%RETURN;
%end; %end;
%local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp; %local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls)); %let ls_tmp = %sysfunc(getoption(ls));
@@ -284,8 +349,6 @@ des = 'Macro to unload SAS package, version 20200730. Run %unloadPackage() for h
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist; %else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist;
filename &_PackageFileref_. clear; filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.; options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.;
/* jump here after running %unloadPackage() - only help is displayed */
%ENDunloadPackage:
%mend unloadPackage; %mend unloadPackage;
/*** HELP START ***/ /*** HELP START ***/
@@ -306,29 +369,38 @@ des = 'Macro to unload SAS package, version 20200730. Run %unloadPackage() for h
null by default */ null by default */
, zip = zip /* standard package is zip (lowcase), , zip = zip /* standard package is zip (lowcase),
e.g. %helpPackage(PiPackage,*) e.g. %helpPackage(PiPackage,*)
if the zip is not avaliable use a folder if the zip is not available use a folder
unpack data to "pipackage.disk" folder unpack data to "pipackage.disk" folder
and use helpPackage in the form: and use helpPackage in the form:
%helpPackage(PiPackage, *, zip=disk, options=) %helpPackage(PiPackage, *, zip=disk, options=)
*/ */
)/secure )/secure
/*** HELP END ***/ /*** HELP END ***/
des = 'Macro to get help about SAS package, version 20200730. Run %helpPackage() for help info.' des = 'Macro to get help about SAS package, version 20200811. Run %helpPackage() for help info.'
; ;
%if %superq(packageName) = %then %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do; %do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ; %put ;
%put ###############################################################################; %put ###############################################################################;
%put # This is short help information for the helpPackage macro #; %put # This is short help information for the helpPackage macro #;
%put ###############################################################################; %put ###############################################################################;
%put # #; %put # #;
%put # Macro to get help about SAS packages, version 20200730 #; %put # Macro to get help about SAS packages, version 20200811 #;
%put # #; %put # #;
%put # A SAS package is a zip file containing a group #; %put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, datasteps generating #; %put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #; %put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #; %put # a single load.sas file (also embedded inside the zip). #;
%put # #; %put # #;
%put # The %nrstr(%%helpPackage()) macro prints in the SAS log help #;
%put # information about the package provided by the developer. #;
%put # #;
%put # Parameters: #; %put # Parameters: #;
%put # #; %put # #;
%put # packageName Name of a package, e.g. myPackage, #; %put # packageName Name of a package, e.g. myPackage, #;
@@ -345,21 +417,46 @@ des = 'Macro to get help about SAS package, version 20200730. Run %helpPackage()
%put # location of the "packages" fileref, i.e. #; %put # location of the "packages" fileref, i.e. #;
%put # %nrstr(%%sysfunc(pathname(packages))) #; %put # %nrstr(%%sysfunc(pathname(packages))) #;
%put # #; %put # #;
%put # options= Posible options for ZIP filename, #; %put # options= Possible options for ZIP filename, #;
%put # default value: LOWCASE_MEMNAME #; %put # default value: LOWCASE_MEMNAME #;
%put # #; %put # #;
%put # source2= Option to print out details, null by default. #; %put # source2= Option to print out details, null by default. #;
%put # #; %put # #;
%put # zip=zip Standard package is zip (lowcase), #; %put # zip=zip Standard package is zip (lowcase), #;
%put # e.g. %nrstr(%%helpPackage(PiPackage)). #; %put # e.g. %nrstr(%%helpPackage(PiPackage)). #;
%put # If the zip is not avaliable use a folder. #; %put # If the zip is not available use a folder. #;
%put # Unpack data to "pipackage.disk" folder #; %put # Unpack data to "pipackage.disk" folder #;
%put # and use loadPackage in the following form: #; %put # and use loadPackage in the following form: #;
%put # %nrstr(%%helpPackage(PiPackage, zip=disk, options=)) #; %put # %nrstr(%%helpPackage(PiPackage, zip=disk, options=)) #;
%put # #; %put # #;
%put ###############################################################################; %put ###############################################################################;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to learn more. #;
%put # #;
%put # Example #####################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS package from the Internet. #;
%put # #;
%put # Assume that the SPFinit.sas file #;
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ; %put ;
%GOTO ENDhelpPackage; %put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put %nrstr( %%unloadPackage(SQLinDS) %%* unload the package content from the SAS session; );
%put ;
%put ###############################################################################;
%put ;
options &options_tmp.;
%RETURN;
%end; %end;
%local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp; %local ls_tmp ps_tmp notes_tmp source_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls)); %let ls_tmp = %sysfunc(getoption(ls));
@@ -391,8 +488,6 @@ des = 'Macro to get help about SAS package, version 20200730. Run %helpPackage()
%else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist; %else %put ERROR:[&sysmacroname] File "&path./&packageName..&zip." does not exist;
filename &_PackageFileref_. clear; filename &_PackageFileref_. clear;
options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.; options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp. msglevel = &msglevel_tmp.;
/* jump here after running %helpPackage() - only help is displayed */
%ENDhelpPackage:
%mend helpPackage; %mend helpPackage;
/* /*
@@ -401,9 +496,9 @@ TODO:
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE] - add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
*/ */
/* Macros to install SAS packages, version 20200603 */ /* Macros to install SAS packages, version 20200811 */
/* A SAS package is a zip file containing a group of files /* A SAS package is a zip file containing a group of files
with SAS code (macros, functions, datasteps generating with SAS code (macros, functions, data steps generating
data, etc.) wrapped up together and %INCLUDEed by data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip). a single load.sas file (also embedded inside the zip).
*/ */
@@ -416,22 +511,32 @@ TODO:
) )
/secure /secure
/*** HELP END ***/ /*** HELP END ***/
des = 'Macro to install SAS package, version 20200730. Run %%installPackage() for help info.' des = 'Macro to install SAS package, version 20200811. Run %%installPackage() for help info.'
; ;
%if %superq(packageName) = %then %if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
%do; %do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ; %put ;
%put ########################################################################################; %put ########################################################################################;
%put # This is short help information for the installPackage macro #; %put # This is short help information for the installPackage macro #;
%put ########################################################################################; %put ########################################################################################;
%put # #; %put # #;
%put # Macro to install SAS packages, version 20200730 #; %put # Macro to install SAS packages, version 20200811 #;
%put # #; %put # #;
%put # A SAS package is a zip file containing a group #; %put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, datasteps generating #; %put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #; %put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #; %put # a single load.sas file (also embedded inside the zip). #;
%put # #; %put # #;
%put # The %nrstr(%%installPackage()) macro installs the package zip #;
%put # in the packages folder. The process of installation is equivalent with #;
%put # manual downloading the package zip file into the packages folder. #;
%put # #;
%put # Parameters: #; %put # Parameters: #;
%put # #; %put # #;
%put # packageName Name of a package, e.g. myPackage, #; %put # packageName Name of a package, e.g. myPackage, #;
@@ -448,8 +553,33 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
%put # to be replaceed by new downloaded file. #; %put # to be replaceed by new downloaded file. #;
%put # #; %put # #;
%put ########################################################################################; %put ########################################################################################;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to learn more. #;
%put # #;
%put # Example ##############################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and installing & loading #;
%put # the SQLinDS package from the Internet. #;
%put # #;
%put # Assume that the SPFinit.sas file #;
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ; %put ;
%GOTO ENDinstallPackage; %put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%installPackage(SQLinDS) %%* install the package from the Internet; );
%put %nrstr( %%helpPackage(SQLinDS) %%* get help about the package; );
%put %nrstr( %%loadPackage(SQLinDS) %%* load the package content into the SAS session; );
%put %nrstr( %%unloadPackage(SQLinDS) %%* unload the package content from the SAS session; );
%put ;
%put ########################################################################################;
%put ;
options &options_tmp.;
%RETURN;
%end; %end;
%local ls_tmp ps_tmp notes_tmp source_tmp fullstimer_tmp stimer_tmp msglevel_tmp; %local ls_tmp ps_tmp notes_tmp source_tmp fullstimer_tmp stimer_tmp msglevel_tmp;
%let ls_tmp = %sysfunc(getoption(ls)); %let ls_tmp = %sysfunc(getoption(ls));
@@ -493,7 +623,7 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
if filein = 0 then if filein = 0 then
put "ERROR: Source file:" / put "ERROR: Source file:" /
"ERROR- " in_path / "ERROR- " in_path /
"ERROR- is unavaliable!"; "ERROR- is unavailable!";
if filein > 0; if filein > 0;
put @2 "Source information:"; put @2 "Source information:";
@@ -543,8 +673,6 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
&notes_tmp. &source_tmp. &notes_tmp. &source_tmp.
&stimer_tmp. &fullstimer_tmp. &stimer_tmp. &fullstimer_tmp.
msglevel=&msglevel_tmp.; msglevel=&msglevel_tmp.;
/* jump here after running %installPackage() - only help is displayed */
%ENDinstallPackage:
%mend installPackage; %mend installPackage;
/*** HELP START ***/ /*** HELP START ***/
@@ -558,7 +686,7 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
since it may affect stability of the framework. since it may affect stability of the framework.
**/ **/
/* Example 1: Enabeling the SAS Package Framework /* Example 1: Enabling the SAS Package Framework
and loading the SQLinDS package from the local directory. and loading the SQLinDS package from the local directory.
Assume that the SPFinit.sas file and the SQLinDS Assume that the SPFinit.sas file and the SQLinDS
@@ -571,11 +699,11 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
%include packages(SPFinit.sas); %* enable the framework; %include packages(SPFinit.sas); %* enable the framework;
%helpPackage(SQLinDS) %* get help about the package; %helpPackage(SQLinDS) %* get help about the package;
%loadpackage(SQLinDS) %* load the package content into the SAS session; %loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session; %unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/ */
/* Example 2: Enabeling the SAS Package Framework /* Example 2: Enabling the SAS Package Framework
from the local directory and installing & loading from the local directory and installing & loading
the SQLinDS package from the Internet. the SQLinDS package from the Internet.
@@ -589,11 +717,11 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
%installPackage(SQLinDS) %* install the package from the Internet; %installPackage(SQLinDS) %* install the package from the Internet;
%helpPackage(SQLinDS) %* get help about the package; %helpPackage(SQLinDS) %* get help about the package;
%loadpackage(SQLinDS) %* load the package content into the SAS session; %loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session; %unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/ */
/* Example 3: Enabeling the SAS Package Framework /* Example 3: Enabling the SAS Package Framework
and installing & loading the SQLinDS package and installing & loading the SQLinDS package
from the Internet. from the Internet.
@@ -606,7 +734,7 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
%installPackage(SQLinDS) %* install the package from the Internet; %installPackage(SQLinDS) %* install the package from the Internet;
%helpPackage(SQLinDS) %* get help about the package; %helpPackage(SQLinDS) %* get help about the package;
%loadpackage(SQLinDS) %* load the package content into the SAS session; %loadPackage(SQLinDS) %* load the package content into the SAS session;
%unloadPackage(SQLinDS) %* unload the package content from the SAS session; %unloadPackage(SQLinDS) %* unload the package content from the SAS session;
*/ */
@@ -626,7 +754,7 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
*/ */
/* Example 5: Enabeling the SAS Package Framework from the local directory /* Example 5: Enabling the SAS Package Framework from the local directory
and installing the SQLinDS package from the Internet. and installing the SQLinDS package from the Internet.
Assume that the SPFinit.sas file is located in Assume that the SPFinit.sas file is located in
@@ -636,8 +764,8 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
%include packages(SPFinit.sas); %* enable the framework; %include packages(SPFinit.sas); %* enable the framework;
%installPackage(SQLinDS); %* install package; %installPackage(SQLinDS); %* install package;
%installPackage(SQLinDS); %* overwrite already instaled package; %installPackage(SQLinDS); %* overwrite already installed package;
%installPackage(SQLinDS,replace=0); %* prevent overwrite instaled package; %installPackage(SQLinDS,replace=0); %* prevent overwrite installed package;
%installPackage(NotExistingPackage); %* handling with not existing package; %installPackage(NotExistingPackage); %* handling with not existing package;
@@ -646,7 +774,7 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
/*** HELP END ***/ /*** HELP END ***/
/* optional - obsolite - deprecated; /* optional - obsolete - deprecated;
libname packages "C:/SAS_PACKAGES/"; libname packages "C:/SAS_PACKAGES/";
%include "%sysfunc(pathname(packages))/loadpackage.sas"; %include "%sysfunc(pathname(packages))/loadpackage.sas";
@@ -662,10 +790,10 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
/* Macro to list SAS packages in packages folder. /* Macro to list SAS packages in packages folder.
Version 20200730 Version 20200811
A SAS package is a zip file containing a group A SAS package is a zip file containing a group
of SAS codes (macros, functions, datasteps generating of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and %INCLUDEed by data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip). a single load.sas file (also embedded inside the zip).
*/ */
@@ -681,14 +809,66 @@ des = 'Macro to install SAS package, version 20200730. Run %%installPackage() fo
/*** HELP END ***/ /*** HELP END ***/
%macro listPackages()/ %macro listPackages()/PARMBUFF
des = 'Macro to list SAS package from `package` fileref, version 20200730.' des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20200811.'
; ;
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
%do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ;
%put ########################################################################################;
%put # This is short help information for the listPackages macro #;
%put ########################################################################################;
%put # #;
%put # Macro to list available SAS packages, version 20200811 #;
%put # #;
%put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #;
%put # #;
%put # The %nrstr(%%listPackages()) macro lists packages available #;
%put # in the packages folder. List is printed inthe SAS Log. #;
%put # #;
%put # Parameters: NO PARAMETERS #;
%put # #;
%put # When used as: %nrstr(%%listPackages(HELP)) it displays this help information. #;
%put # #;
%put ########################################################################################;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to learn more. #;
%put # #;
%put # Example ##############################################################################;
%put # #;
%put # Enabling the SAS Package Framework #;
%put # from the local directory and listing #;
%put # available packages. #;
%put # #;
%put # Assume that the SPFinit.sas file #;
%put # is located in the "C:/SAS_PACKAGES/" folder. #;
%put # #;
%put # Run the following code in your SAS session: #;
%put ;
%put %nrstr( filename packages "C:/SAS_PACKAGES"; %%* setup a directory for packages; );
%put %nrstr( %%include packages(SPFinit.sas); %%* enable the framework; );
%put ;
%put %nrstr( %%listPackages() %%* list available packages; );
%put ;
%put ########################################################################################;
%put ;
options &options_tmp.;
%RETURN;
%end;
%local ls_tmp ps_tmp notes_tmp source_tmp; %local ls_tmp ps_tmp notes_tmp source_tmp filesWithCodes;
%let filesWithCodes = WORK._%sysfunc(datetime(), hex16.)_; %let filesWithCodes = WORK._%sysfunc(datetime(), hex16.)_;
%local ls_tmp ps_tmp notes_tmp source_tmp;
%let ls_tmp = %sysfunc(getoption(ls)); %let ls_tmp = %sysfunc(getoption(ls));
%let ps_tmp = %sysfunc(getoption(ps)); %let ps_tmp = %sysfunc(getoption(ps));
%let notes_tmp = %sysfunc(getoption(notes)); %let notes_tmp = %sysfunc(getoption(notes));
@@ -700,7 +880,7 @@ data _null_;
if base = " " then if base = " " then
do; do;
put "NOTE: The filereference PACKAGES is not assigned."; put "NOTE: The file reference PACKAGES is not assigned.";
stop; stop;
end; end;
@@ -739,7 +919,7 @@ data _null_;
_INFILE_ = scan(_INFILE_,1,":") !! ":" !! scan(_INFILE_,2,":"); _INFILE_ = scan(_INFILE_,1,":") !! ":" !! scan(_INFILE_,2,":");
putlog " * " _INFILE_; putlog " * " _INFILE_;
end; end;
if strip(_INFILE_) = "DESCRIPTION START:" then leave; if upcase(strip(_INFILE_)) =: "DESCRIPTION START:" then leave;
end; end;
end; end;
@@ -760,13 +940,12 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
/*** HELP START ***/ /*** HELP START ***/
/* Macros to generate SAS packages. /* Macro to generate SAS packages.
Version 20200730
Version 20200811
A SAS package is a zip file containing a group A SAS package is a zip file containing a group
of SAS codes (macros, functions, datasteps generating of SAS codes (macros, functions, data steps generating
data, etc.) wrapped up together and %INCLUDEed by data, etc.) wrapped up together and %INCLUDEed by
a single load.sas file (also embedded inside the zip). a single load.sas file (also embedded inside the zip).
@@ -778,7 +957,7 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
/*** HELP START ***/ /*** HELP START ***/
%macro generatePackage( %macro generatePackage(
filesLocation= /* location of package files filesLocation /* location of package files
e.g. %sysfunc(pathname(work))/%lowcase(&packageName.) */ e.g. %sysfunc(pathname(work))/%lowcase(&packageName.) */
,testPackage=Y /* indicator if tests should be executed, ,testPackage=Y /* indicator if tests should be executed,
default value Y means "execute tests" */ default value Y means "execute tests" */
@@ -786,22 +965,36 @@ options ls = &ls_tmp. ps = &ps_tmp. &notes_tmp. &source_tmp.;
dependencies in loading */ dependencies in loading */
)/secure )/secure
/*** HELP END ***/ /*** HELP END ***/
des = 'Macro to generate SAS packages, version 20200730. Run %generatePackage() for help info.' des = 'Macro to generate SAS packages, version 20200811. Run %generatePackage() for help info.'
; ;
%if %superq(filesLocation) = %then %if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
%do; %do;
%local options_tmp ;
%let options_tmp = ls=%sysfunc(getoption(ls))ps=%sysfunc(getoption(ps))
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
msglevel=%sysfunc(getoption(msglevel))
;
options NOnotes NOsource ls=MAX ps=MAX msglevel=N;
%put ; %put ;
%put ###############################################################################; %put ###############################################################################;
%put # This is short help information for the generatePackage macro #; %put # This is short help information for the generatePackage macro #;
%put ###############################################################################; %put ###############################################################################;
%put # #; %put # #;
%put # Macro to generate SAS packages, version 20200730 #; %put # Macro to generate SAS packages, version 20200811 #;
%put # #; %put # #;
%put # A SAS package is a zip file containing a group #; %put # A SAS package is a zip file containing a group #;
%put # of SAS codes (macros, functions, datasteps generating #; %put # of SAS codes (macros, functions, data steps generating #;
%put # data, etc.) wrapped up together and included by #; %put # data, etc.) wrapped up together and included by #;
%put # a single load.sas file (also embedded inside the zip). #; %put # a single load.sas file (also embedded inside the zip). #;
%put # #; %put # #;
%put # The %nrstr(%%generatePackage()) macro generates SAS packages. #;
%put # It wraps-up the package content, i.e. macros, functions, formats, etc., #;
%put # into the zip file and generate all metadata content required by other #;
%put # macros from the SAS Packages Framework. #;
%put # #;
%put # Visit: https://github.com/yabwon/SAS_PACKAGES/tree/master/SPF/Documentation #;
%put # to read about the details of package generation process. #;
%put # #;
%put # Parameters: #; %put # Parameters: #;
%put # #; %put # #;
%put # filesLocation= Location of package files, example value: #; %put # filesLocation= Location of package files, example value: #;
@@ -818,7 +1011,8 @@ des = 'Macro to generate SAS packages, version 20200730. Run %generatePackage()
%put # #; %put # #;
%put ###############################################################################; %put ###############################################################################;
%put ; %put ;
%GOTO ENDgeneratePackage; options &options_tmp.;
%RETURN;
%end; %end;
%local zipReferrence filesWithCodes _DESCR_ _LIC_ _RC_ _PackageFileref_; %local zipReferrence filesWithCodes _DESCR_ _LIC_ _RC_ _PackageFileref_;
@@ -862,7 +1056,7 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 256;
when(upcase(scan(_INFILE_, 1, ":")) = "REQPACKAGES") call symputX("packageReqPackages", scan(_INFILE_, 2, ":"),"L"); when(upcase(scan(_INFILE_, 1, ":")) = "REQPACKAGES") call symputX("packageReqPackages", scan(_INFILE_, 2, ":"),"L");
/* stop at the beginning of description */ /* stop at the beginning of description */
when(upcase(scan(_INFILE_, 1, ":")) = "DESCRIPTION START") stop; when ( upcase(scan(_INFILE_, 1, ":")) = "DESCRIPTION START" ) stop;
otherwise; otherwise;
end; end;
run; run;
@@ -894,7 +1088,7 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 256;
%do; %do;
%put ERROR: Package name is more than 24 characters long.; %put ERROR: Package name is more than 24 characters long.;
%put ERROR- The name is used for functions%str(%') dataset name; %put ERROR- The name is used for functions%str(%') dataset name;
%put ERROR- and for formats%str(%') cataloge name (with suffix).; %put ERROR- and for formats%str(%') catalog name (with suffix).;
%put ERROR- The length is %sysfunc(lengthn(&packageName.)). Try something shorter.; %put ERROR- The length is %sysfunc(lengthn(&packageName.)). Try something shorter.;
%abort; %abort;
%end; %end;
@@ -908,7 +1102,7 @@ filename &_LIC_. "&filesLocation./license.sas" lrecl = 256;
%do; %do;
%put ERROR: Package name contains illegal symbols.; %put ERROR: Package name contains illegal symbols.;
%put ERROR- The name is used for functions%str(%') dataset name; %put ERROR- The name is used for functions%str(%') dataset name;
%put ERROR- and for formats%str(%') cataloge name.; %put ERROR- and for formats%str(%') catalog name.;
%put ERROR- Only English letters, underscore(_), and digits are allowed.; %put ERROR- Only English letters, underscore(_), and digits are allowed.;
%put ERROR- Try something else. Maybe: %qsysfunc(compress(&packageName.,,KDF)) will do?; %put ERROR- Try something else. Maybe: %qsysfunc(compress(&packageName.,,KDF)) will do?;
%abort; %abort;
@@ -1228,7 +1422,7 @@ data _null_;
run; run;
/* emergency ICEloadPackage macro to load package when loadPackage() /* emergency ICEloadPackage macro to load package when loadPackage()
is unavaliable for some reasons, example of use: is unavailable for some reasons, example of use:
1) point to a zip file, 1) point to a zip file,
2) include iceloadpackage.sas 2) include iceloadpackage.sas
3) point to package folder, 3) point to package folder,
@@ -1250,6 +1444,7 @@ data _null_;
put ' , path = %sysfunc(pathname(packages)) /* location of a package */ '; put ' , path = %sysfunc(pathname(packages)) /* location of a package */ ';
put ' , options = %str(LOWCASE_MEMNAME) /* possible options for ZIP */ '; put ' , options = %str(LOWCASE_MEMNAME) /* possible options for ZIP */ ';
put ' , zip = zip /* file ext. */ '; put ' , zip = zip /* file ext. */ ';
put ' , requiredVersion = . /* required version */ ';
put ' , source2 = /* source2*/ '; put ' , source2 = /* source2*/ ';
put ' )/secure; '; put ' )/secure; ';
put ' %PUT ** NOTE: Package ' "&packageName." ' loaded in ICE mode **; '; put ' %PUT ** NOTE: Package ' "&packageName." ' loaded in ICE mode **; ';
@@ -1260,10 +1455,22 @@ data _null_;
put ' ; '; put ' ; ';
put ' %include &_PackageFileref_.(packagemetadata.sas) / &source2.; '; put ' %include &_PackageFileref_.(packagemetadata.sas) / &source2.; ';
put ' filename &_PackageFileref_. clear; '; put ' filename &_PackageFileref_. clear; ';
/* test if required version of package is "good enough" */
put ' %if %sysevalf(&requiredVersion. > &packageVersion.) %then ';
put ' %do; ';
put ' %put ERROR: Required version is &requiredVersion.; ';
put ' %put ERROR- Provided version is &packageVersion.; ';
put ' %ABORT; ';
put ' %end; ';
put ' filename &_PackageFileref_. &ZIP. '; put ' filename &_PackageFileref_. &ZIP. ';
put ' "&path./%lowcase(&packageName.).&zip." %unquote(&options.) '; put ' "&path./%lowcase(&packageName.).&zip." %unquote(&options.) ';
put ' ENCODING = '; put ' ENCODING = ';
put ' %if %bquote(&packageEncoding.) NE %then &packageEncoding. ;; '; put ' %if %bquote(&packageEncoding.) NE %then &packageEncoding. ; ';
put ' %else utf8 ; ';
put ' ; ';
put ' %include &_PackageFileref_.(load.sas) / &source2.; '; put ' %include &_PackageFileref_.(load.sas) / &source2.; ';
put ' filename &_PackageFileref_. clear; '; put ' filename &_PackageFileref_. clear; ';
put ' %mend ICEloadPackage; '; put ' %mend ICEloadPackage; ';
@@ -1390,6 +1597,9 @@ data _null_;
put ' vers = input(compress(scan(req,-1, "("), ".", "KD"),best32.); '; put ' vers = input(compress(scan(req,-1, "("), ".", "KD"),best32.); ';
put ' _RC_ = LP.add(); '; put ' _RC_ = LP.add(); ';
put ' end; '; put ' end; ';
/* check if elements of the framewor are available */
put ' LoadPackageExist = input(resolve(''%SYSMACEXIST( loadPackage)''), best.); ';
put ' ICELoadPackageExist = input(resolve(''%SYSMACEXIST(ICEloadPackage)''), best.); ';
put ' do req = ' / packageReqPackages / ' ; '; put ' do req = ' / packageReqPackages / ' ; ';
/* put ' req = compress(req, "(.)", "KDF"); ';*/ /* put ' req = compress(req, "(.)", "KDF"); ';*/
@@ -1398,8 +1608,11 @@ data _null_;
put ' LP_find = LP.find(); '; put ' LP_find = LP.find(); ';
put ' if (LP_find ne 0) or (LP_find = 0 and . < vers < verR) then '; put ' if (LP_find ne 0) or (LP_find = 0 and . < vers < verR) then ';
put ' do; '; put ' do; ';
put ' put "NOTE: Trying to install required SAS package " req; '; put ' put "NOTE: Trying to load required SAS package " req; ';
put ' if LoadPackageExist then ';
put ' call execute(cats(''%nrstr(%loadPackage('', name, ", requiredVersion = ", verR, "))")); '; put ' call execute(cats(''%nrstr(%loadPackage('', name, ", requiredVersion = ", verR, "))")); ';
put ' else if ICELoadPackageExist then ';
put ' call execute(cats(''%nrstr(%ICEloadPackage('', name, ", requiredVersion = ", verR, "))")); ';
put ' end ; '; put ' end ; ';
put ' end ; '; put ' end ; ';
put ' stop; '; put ' stop; ';
@@ -1617,14 +1830,18 @@ data _null_;
put 'data _null_;'; put 'data _null_;';
put ' length lazyData $ 32767; lazyData = lowcase(symget("lazyData"));'; put ' length lazyData $ 32767; lazyData = lowcase(symget("lazyData"));';
do until(eof); do until(eof);
set &filesWithCodes.(where=( upcase(type) =: 'LAZYDATA' )) end = EOF nobs=NOBS; set &filesWithCodes. end = EOF nobs=NOBS;
if ( upcase(type) =: 'LAZYDATA' ) then
do;
put 'if lazyData="*" OR findw(lazyData, "' fileshort +(-1) '") then'; put 'if lazyData="*" OR findw(lazyData, "' fileshort +(-1) '") then';
put 'do;'; put 'do;';
put ' put "NOTE- Dataset ' fileshort 'from the file ""' file +(-1) '"" will be loaded";'; put ' put "NOTE- Dataset ' fileshort 'from the file ""' file +(-1) '"" will be loaded";';
put ' call execute(''%nrstr(%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;)'');'; put ' call execute(''%nrstr(%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;)'');';
put 'end;'; put 'end;';
end; end;
end;
put 'run;'; put 'run;';
put '%put NOTE- ;'; put '%put NOTE- ;';
@@ -1883,9 +2100,9 @@ data _null_;
put ' do until (EOF); '; put ' do until (EOF); ';
put " infile &_PackageFileref_.(description.sas) end = EOF; "; put " infile &_PackageFileref_.(description.sas) end = EOF; ";
put ' input; '; put ' input; ';
put ' if upcase(strip(_infile_)) = "DESCRIPTION END:" then printer = 0; '; put ' if upcase(strip(_infile_)) =: "DESCRIPTION END:" then printer = 0; ';
put ' if printer then put "*> " _infile_; '; put ' if printer then put "*> " _infile_; ';
put ' if upcase(strip(_infile_)) = "DESCRIPTION START:" then printer = 1; '; put ' if upcase(strip(_infile_)) =: "DESCRIPTION START:" then printer = 1; ';
put ' end; '; put ' end; ';
put ' else stop; '; put ' else stop; ';
@@ -1922,7 +2139,7 @@ data _null_;
put ' end ; '; put ' end ; ';
%end; %end;
put 'put "***"; put "* SAS package generated by generatePackage, version 20200730 *"; put "***";'; put 'put "***"; put "* SAS package generated by generatePackage, version 20200811 *"; put "***";';
put 'run; ' /; put 'run; ' /;
@@ -1985,17 +2202,17 @@ data _null_;
put ' set WORK._last_ end = EOFDS nobs = NOBS; '; put ' set WORK._last_ end = EOFDS nobs = NOBS; ';
put ' length memberX $ 1024; '; put ' length memberX $ 1024; ';
put ' memberX = cats("_",folder,".",file); '; put ' memberX = cats("_",folder,".",file); ';
/* inner datastep in call execute to read each embedded file */ /* inner data step in call execute to read each embedded file */
put ' call execute("data _null_; ");'; put ' call execute("data _null_; ");';
put " call execute('infile &_PackageFileref_.(' || strip(memberX) || ') end = EOF; ');"; put " call execute('infile &_PackageFileref_.(' || strip(memberX) || ') end = EOF; ');";
put ' call execute(" printer = 0; ");'; put ' call execute(" printer = 0; ");';
put ' call execute(" do until(EOF); ");'; put ' call execute(" do until(EOF); ");';
put ' call execute(" input; ");'; put ' call execute(" input; ");';
put ' call execute(" if upcase(strip(_infile_)) '; put ' call execute(" if upcase(strip(_infile_)) ';
put ' = cat(""/"",""*** "",""HELP END"","" ***"",""/"") then printer = 0; ");'; /* it looks like that because of comments */ put ' = ''/*** HELP END ***/'' then printer = 0; ");';
put ' call execute(" if printer then put ""*> "" _infile_; ");'; put ' call execute(" if printer then put ""*> "" _infile_; ");';
put ' call execute(" if upcase(strip(_infile_)) '; put ' call execute(" if upcase(strip(_infile_)) ';
put ' = cat(""/"",""*** "",""HELP START"","" ***"",""/"") then printer = 1; ");'; /* it looks like that because of comments */ put ' = ''/*** HELP START ***/'' then printer = 1; ");';
put ' call execute(" end; ");'; put ' call execute(" end; ");';
put ' call execute(" put ""*> "" / ""*> ""; ");'; put ' call execute(" put ""*> "" / ""*> ""; ");';
put ' call execute(" stop; ");'; put ' call execute(" stop; ");';
@@ -2030,19 +2247,19 @@ data _null_;
set &filesWithCodes. nobs = NOBS; set &filesWithCodes. nobs = NOBS;
if (upcase(type) not in: ('TEST')); /* test files are not to be copied */ if (upcase(type) not in: ('TEST')); /* test files are not to be copied */
call execute(cat ('filename _IN_ "', catx('/', base, folder, file), '";')); call execute(cat ('filename _SPFIN_ "', catx('/', base, folder, file), '";'));
call execute(cats("filename _OUT_ ZIP '", base, "/%lowcase(&packageName.).zip' member='_", folder, ".", file, "';") ); call execute(cats("filename _SPFOUT_ ZIP '", base, "/%lowcase(&packageName.).zip' member='_", folder, ".", file, "';") );
/* copy code file into the zip */ /* copy code file into the zip */
call execute('data _null_;'); call execute('data _null_;');
call execute(' rc = fcopy("_IN_", "_OUT_");'); call execute(' rc = fcopy("_SPFIN_", "_SPFOUT_");');
call execute('run;'); call execute('run;');
/* test file content for help tags */ /* test file content for help tags */
call execute('data _null_;'); call execute('data _null_;');
call execute(' retain test .;'); call execute(' retain test .;');
call execute(' infile _IN_ lrecl=32767 dlm="0a0d"x end=EOF;'); call execute(' infile _SPFIN_ lrecl=32767 dlm="0a0d"x end=EOF;');
call execute(' input;'); call execute(' input;');
call execute(' if upcase(strip(_infile_)) = cat("/","*** ","HELP START"," ***","/") then test + (+1); '); call execute(' if upcase(strip(_infile_)) = "/*** HELP START ***/" then test + (+1); ');
call execute(' if upcase(strip(_infile_)) = cat("/","*** ","HELP END", " ***","/") then test + (-1); '); call execute(' if upcase(strip(_infile_)) = "/*** HELP END ***/" then test + (-1); ');
call execute(' if (test not in (.,0,1)) or (EOF and test) then '); call execute(' if (test not in (.,0,1)) or (EOF and test) then ');
call execute(' do; '); call execute(' do; ');
call execute(' put "ERR" "OR: unmatching or nested HELP tags!" _N_=; '); call execute(' put "ERR" "OR: unmatching or nested HELP tags!" _N_=; ');
@@ -2051,14 +2268,16 @@ data _null_;
call execute(' if (EOF and test=.) then put "WARN" "ING: no HELP tags in the file." ; '); call execute(' if (EOF and test=.) then put "WARN" "ING: no HELP tags in the file." ; ');
call execute('run;'); call execute('run;');
call execute('filename _IN_ clear;'); call execute('filename _SPFIN_ clear;');
call execute('filename _OUT_ clear;'); call execute('filename _SPFOUT_ clear;');
run; run;
/* /*
proc sql; proc sql;
drop table &filesWithCodes.; drop table &filesWithCodes.;
quit; quit;
*/ */
filename &_DESCR_. clear;
filename &_LIC_. clear;
filename &zipReferrence. clear; filename &zipReferrence. clear;
/* tests of package are executed by default */ /* tests of package are executed by default */
@@ -2076,6 +2295,7 @@ filename &zipReferrence. clear;
/* locate sas binaries */ /* locate sas binaries */
%local SASROOT SASEXE SASWORK;
filename sasroot "!SASROOT"; filename sasroot "!SASROOT";
%let SASROOT=%sysfunc(PATHNAME(sasroot)); %let SASROOT=%sysfunc(PATHNAME(sasroot));
filename sasroot; filename sasroot;
@@ -2099,14 +2319,18 @@ filename currdir list;
/* if your package uses any other packages this points to their location */ /* if your package uses any other packages this points to their location */
/* test if packages fileref exists and if do then use it */ /* test if packages fileref exists and if do then use it */
/* if no one is provided the filesLocation is used as a repalacement */ /* if no one is provided the filesLocation is used as a replacement */
%if %bquote(&packages.)= %then %let packages=%sysfunc(pathname(packages)); %if %bquote(&packages.)= %then %let packages=%sysfunc(pathname(packages));
%if %bquote(&packages.)= %then %let packages=&filesLocation.; %if %bquote(&packages.)= %then %let packages=&filesLocation.;
filename packages "&packages."; %put NOTE- ;
filename packages list; %put NOTE: The following location path for packages will be used during the testing:;
%put *&packages.*;
/* filename packages "&packages."; */
/* filename packages list;*/
/* replace current dir with the temporary one for tests */ /* replace current dir with the temporary one for tests */
%put *NOTE: changing current folder to:*; %put NOTE- ;
%put NOTE: changing current folder to:;
%put *%sysfunc(DLGCDIR(&dirForTest.))*; %put *%sysfunc(DLGCDIR(&dirForTest.))*;
/* the first test is for loading package, testing help and unloading */ /* the first test is for loading package, testing help and unloading */
@@ -2198,6 +2422,9 @@ data _null_;
call symputX(cats("TEST_", test), fileshort, "L"); call symputX(cats("TEST_", test), fileshort, "L");
call symputX("numberOfTests", test, "L"); call symputX("numberOfTests", test, "L");
_RC_ = filename(cats("_TIN_",test));
_RC_ = filename(cats("_TOUT_",test));
run; run;
/* each test is executed with autoexec loading the package */ /* each test is executed with autoexec loading the package */
@@ -2284,7 +2511,7 @@ title;
%put *NOTE: changing current folder to:*; %put *NOTE: changing current folder to:*;
%put *%sysfunc(DLGCDIR(%sysfunc(pathname(currdir))))*; %put *%sysfunc(DLGCDIR(%sysfunc(pathname(currdir))))*;
filename CURRDIR clear;
/* if you do not want any test to be executed */ /* if you do not want any test to be executed */
%NOTESTING: %NOTESTING:
@@ -2293,9 +2520,6 @@ proc sql;
drop table &filesWithCodes.; drop table &filesWithCodes.;
quit; quit;
/* jump here after running %generatePackage() - only help is displayed */
%ENDgeneratePackage:
%mend generatePackage; %mend generatePackage;
@@ -2341,7 +2565,7 @@ TODO: (in Polish)
/*** HELP START ***/ /*** HELP START ***/
/* Example 1: Enabeling the SAS Package Framework /* Example 1: Enabling the SAS Package Framework
and generating the SQLinDS package from the local directory. and generating the SQLinDS package from the local directory.
Assume that the SPFinit.sas file and the SQLinDS Assume that the SPFinit.sas file and the SQLinDS

View File

@@ -1,3 +1,6 @@
## SAS Packages:
To get started with SAS Packages try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/master/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
## Available packages: ## Available packages:
Currently the following packages are available: Currently the following packages are available:
@@ -57,7 +60,7 @@ run;
%end; %end;
``` ```
- **BasePlus**\[0.5\] adds a bunch of functionalities I am missing in BASE SAS, such as: - **BasePlus**\[0.52\] adds a bunch of functionalities I am missing in BASE SAS, such as:
``` ```
call arrMissToRight(myArray); call arrMissToRight(myArray);
call arrFillMiss(17, myArray); call arrFillMiss(17, myArray);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.