mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-01-11 17:00:04 +00:00
Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4eac2a0fea | ||
|
|
ad81e0cb0e | ||
|
|
f542d70332 | ||
|
|
80fdc9f214 | ||
|
|
f23afe7486 | ||
|
|
e467959d77 | ||
|
|
035e184b74 | ||
|
|
61d5806e79 | ||
|
|
98871647dd | ||
|
|
16b744a763 | ||
|
|
4765dc5c43 | ||
|
|
e1c95da0b7 | ||
|
|
319dd8c46b | ||
|
|
96555584a3 | ||
|
|
a6cfb9f93f | ||
|
|
63b30d7b6e | ||
|
|
eef8649f3c | ||
|
|
4511c812f0 | ||
|
|
5ca878d178 | ||
|
|
5c042cadff | ||
|
|
3eb09f29cd | ||
|
|
da3c8df259 | ||
|
|
b9fa8fc5d7 | ||
|
|
1fda328de8 | ||
|
|
322a951290 | ||
|
|
b090fdbe8d | ||
|
|
42663d56f7 | ||
|
|
bed882582e | ||
|
|
532f1ec90e | ||
|
|
861c5d866b | ||
|
|
f22d06fb42 | ||
|
|
c0212cb8af | ||
|
|
4ae8f23716 |
@@ -6,7 +6,7 @@ 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 `20200807`.
|
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is `20200815`.
|
||||||
|
|
||||||
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).
|
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).
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **BasePlus**\[0.52\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
- **BasePlus**\[0.53\] 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);
|
||||||
@@ -100,7 +100,7 @@ string = catXFn("date9.", "#", myArray);
|
|||||||
|
|
||||||
format x bool.;
|
format x bool.;
|
||||||
|
|
||||||
%put %getVars(sashelp.class, patern = ght$, sep = +, varRange = _numeric_);
|
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||||
```
|
```
|
||||||
|
|
||||||
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
261
SPF/SPFinit.sas
261
SPF/SPFinit.sas
@@ -42,7 +42,7 @@
|
|||||||
- to unload, or
|
- to unload, or
|
||||||
- to generate SAS packages.
|
- to generate SAS packages.
|
||||||
|
|
||||||
Version 20200807.
|
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
|
||||||
@@ -81,16 +81,22 @@
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to load SAS package, version 20200807. 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 20200807 #;
|
%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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -158,6 +164,7 @@ des = 'Macro to load SAS package, version 20200807. Run %loadPackage() for help
|
|||||||
%put ;
|
%put ;
|
||||||
%put ###############################################################################;
|
%put ###############################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%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;
|
||||||
@@ -235,16 +242,22 @@ des = 'Macro to load SAS package, version 20200807. Run %loadPackage() for help
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to unload SAS package, version 20200807. 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 20200807 #;
|
%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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -303,6 +316,7 @@ des = 'Macro to unload SAS package, version 20200807. Run %unloadPackage() for h
|
|||||||
%put ;
|
%put ;
|
||||||
%put ###############################################################################;
|
%put ###############################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%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;
|
||||||
@@ -362,16 +376,22 @@ des = 'Macro to unload SAS package, version 20200807. Run %unloadPackage() for h
|
|||||||
*/
|
*/
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to get help about SAS package, version 20200807. 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 20200807 #;
|
%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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -435,6 +455,7 @@ des = 'Macro to get help about SAS package, version 20200807. Run %helpPackage()
|
|||||||
%put ;
|
%put ;
|
||||||
%put ###############################################################################;
|
%put ###############################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%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;
|
||||||
@@ -475,7 +496,7 @@ 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 20200807 */
|
/* 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, data steps 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
|
||||||
@@ -490,16 +511,22 @@ TODO:
|
|||||||
)
|
)
|
||||||
/secure
|
/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to install SAS package, version 20200807. 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 20200807 #;
|
%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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -551,6 +578,7 @@ des = 'Macro to install SAS package, version 20200807. Run %%installPackage() fo
|
|||||||
%put ;
|
%put ;
|
||||||
%put ########################################################################################;
|
%put ########################################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%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;
|
||||||
@@ -762,7 +790,7 @@ des = 'Macro to install SAS package, version 20200807. Run %%installPackage() fo
|
|||||||
|
|
||||||
/* Macro to list SAS packages in packages folder.
|
/* Macro to list SAS packages in packages folder.
|
||||||
|
|
||||||
Version 20200807
|
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, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -782,16 +810,22 @@ des = 'Macro to install SAS package, version 20200807. Run %%installPackage() fo
|
|||||||
|
|
||||||
|
|
||||||
%macro listPackages()/PARMBUFF
|
%macro listPackages()/PARMBUFF
|
||||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20200807.'
|
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20200811.'
|
||||||
;
|
;
|
||||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
%if %QUPCASE(&SYSPBUFF.) = %str(%(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 listPackages macro #;
|
%put # This is short help information for the listPackages macro #;
|
||||||
%put ########################################################################################;
|
%put ########################################################################################;
|
||||||
%put # #;
|
%put # #;
|
||||||
%put # Macro to list available SAS packages, version 20200807 #;
|
%put # Macro to list available 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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -828,6 +862,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
|
|||||||
%put ;
|
%put ;
|
||||||
%put ########################################################################################;
|
%put ########################################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%RETURN;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
@@ -849,14 +884,14 @@ data _null_;
|
|||||||
stop;
|
stop;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
length folder file $ 256 folderRef fileRef $ 8;
|
length folder $ 64 file $ 1024 folderRef fileRef $ 8;
|
||||||
|
|
||||||
folderRef = "_%sysfunc(datetime(), hex6.)0";
|
folderRef = "_%sysfunc(datetime(), hex6.)0";
|
||||||
|
|
||||||
rc=filename(folderRef, base);
|
rc=filename(folderRef, base);
|
||||||
folderid=dopen(folderRef);
|
folderid=dopen(folderRef);
|
||||||
|
|
||||||
put;
|
putlog " ";
|
||||||
put "/*" 100*"+" ;
|
put "/*" 100*"+" ;
|
||||||
do i=1 to dnum(folderId); drop i;
|
do i=1 to dnum(folderId); drop i;
|
||||||
folder = dread(folderId, i);
|
folder = dread(folderId, i);
|
||||||
@@ -868,31 +903,36 @@ data _null_;
|
|||||||
EOF = 0;
|
EOF = 0;
|
||||||
if fileId = 0 and lowcase(scan(folder, -1, ".")) = 'zip' then
|
if fileId = 0 and lowcase(scan(folder, -1, ".")) = 'zip' then
|
||||||
do;
|
do;
|
||||||
file = catx('/',base, folder);
|
putlog " * ";
|
||||||
length nn $ 96;
|
file = catx('/',base, folder);
|
||||||
nn = repeat("*", (96-lengthn(file)));
|
|
||||||
|
|
||||||
putlog " ";
|
length nn $ 96;
|
||||||
put " * " file @; put nn /;
|
if (96-lengthn(file)) < 1 then
|
||||||
|
put " * " file;
|
||||||
|
else
|
||||||
|
do;
|
||||||
|
nn = repeat("*", (96-lengthn(file)));
|
||||||
|
put " * " file nn;
|
||||||
|
end;
|
||||||
|
|
||||||
infile package ZIP FILEVAR=file member="description.sas" end=EOF;
|
infile package ZIP FILEVAR=file member="description.sas" end=EOF;
|
||||||
|
|
||||||
do until(EOF);
|
do until(EOF);
|
||||||
input;
|
input;
|
||||||
if lowcase(scan(_INFILE_,1,":")) in ("package" "title" "version" "author" "maintainer" "license") then
|
if lowcase(scan(_INFILE_,1,":")) in ("package" "title" "version" "author" "maintainer" "license") then
|
||||||
do;
|
do;
|
||||||
_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;
|
||||||
|
|
||||||
rc = dclose(fileId);
|
rc = dclose(fileId);
|
||||||
rc = filename(fileRef);
|
rc = filename(fileRef);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
putlog " ";
|
putlog " * ";
|
||||||
put 100*"+" "*/";
|
put 100*"+" "*/";
|
||||||
rc = dclose(folderid);
|
rc = dclose(folderid);
|
||||||
rc = filename(folderRef);
|
rc = filename(folderRef);
|
||||||
@@ -907,7 +947,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
|||||||
|
|
||||||
/* Macro to generate SAS packages.
|
/* Macro to generate SAS packages.
|
||||||
|
|
||||||
Version 20200807
|
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, data steps generating
|
of SAS codes (macros, functions, data steps generating
|
||||||
@@ -922,7 +962,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_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" */
|
||||||
@@ -930,16 +970,22 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
|||||||
dependencies in loading */
|
dependencies in loading */
|
||||||
)/secure
|
)/secure
|
||||||
/*** HELP END ***/
|
/*** HELP END ***/
|
||||||
des = 'Macro to generate SAS packages, version 20200807. 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 20200807 #;
|
%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, data steps generating #;
|
%put # of SAS codes (macros, functions, data steps generating #;
|
||||||
@@ -970,6 +1016,7 @@ des = 'Macro to generate SAS packages, version 20200807. Run %generatePackage()
|
|||||||
%put # #;
|
%put # #;
|
||||||
%put ###############################################################################;
|
%put ###############################################################################;
|
||||||
%put ;
|
%put ;
|
||||||
|
options &options_tmp.;
|
||||||
%RETURN;
|
%RETURN;
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
@@ -1014,7 +1061,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;
|
||||||
@@ -1402,6 +1449,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 **; ';
|
||||||
@@ -1412,10 +1460,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; ';
|
||||||
@@ -1542,18 +1602,24 @@ 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"); ';*/
|
||||||
put ' name = lowcase(strip(scan(req, 1, "("))); ';
|
put ' name = lowcase(strip(scan(req, 1, "("))); ';
|
||||||
put ' verR = input(compress(scan(req,-1, "("), ".", "KD"),best32.); vers = .; ';
|
put ' verR = input(compress(scan(req,-1, "("), ".", "KD"),best32.); vers = .; ';
|
||||||
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 ' call execute(cats(''%nrstr(%loadPackage('', name, ", requiredVersion = ", verR, "))")); ';
|
put ' if LoadPackageExist then ';
|
||||||
put ' end ; ';
|
put ' call execute(cats(''%nrstr(%loadPackage('', name, ", requiredVersion = ", verR, "))")); ';
|
||||||
put ' end ; ';
|
put ' else if ICELoadPackageExist then ';
|
||||||
|
put ' call execute(cats(''%nrstr(%ICEloadPackage('', name, ", requiredVersion = ", verR, "))")); ';
|
||||||
|
put ' end ; ';
|
||||||
|
put ' end ; ';
|
||||||
put ' stop; ';
|
put ' stop; ';
|
||||||
put 'run; ';
|
put 'run; ';
|
||||||
|
|
||||||
@@ -1634,7 +1700,7 @@ data _null_;
|
|||||||
*/
|
*/
|
||||||
/* test for supported types */
|
/* test for supported types */
|
||||||
if not (upcase(type) in:
|
if not (upcase(type) in:
|
||||||
('LIBNAME' 'MACRO' 'DATA' 'FUNCTION' /*'FUNCTIONS'*/ 'FORMAT' 'IMLMODULE' 'EXEC' 'CLEAN' 'LAZYDATA' 'TEST'))
|
('LIBNAME' 'MACRO' 'DATA' 'FUNCTION' /*'FUNCTIONS'*/ 'FORMAT' 'IMLMODULE' 'PROTO' 'EXEC' 'CLEAN' 'LAZYDATA' 'TEST'))
|
||||||
then
|
then
|
||||||
do;
|
do;
|
||||||
putlog 'WARNING: Type ' type 'is not yet supported.';
|
putlog 'WARNING: Type ' type 'is not yet supported.';
|
||||||
@@ -1657,11 +1723,15 @@ data _null_;
|
|||||||
put '%put NOTE- ;';
|
put '%put NOTE- ;';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
/* HEADERS for IML and FCMP */
|
/* HEADERS for IML, FCMP, and PROTO */
|
||||||
if 1 = FIRST.type and upcase(type)='FUNCTIONS' then /* header, for multiple functions in one FCMP run */
|
if 1 = FIRST.type and upcase(type)='FUNCTIONS' then /* header, for multiple functions in one FCMP run */
|
||||||
do;
|
do;
|
||||||
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package; ";
|
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package; ";
|
||||||
end;
|
end;
|
||||||
|
if 1 = FIRST.type and upcase(type)='PROTO' then /* header, for multiple functions in one FCMP run */
|
||||||
|
do;
|
||||||
|
put "proc proto package = work.%lowcase(&packageName.proto).package; ";
|
||||||
|
end;
|
||||||
if 1 = FIRST.type and upcase(type)='IMLMODULE' then /* header, for IML modules */
|
if 1 = FIRST.type and upcase(type)='IMLMODULE' then /* header, for IML modules */
|
||||||
do;
|
do;
|
||||||
put "proc iml; ";
|
put "proc iml; ";
|
||||||
@@ -1670,7 +1740,7 @@ data _null_;
|
|||||||
/* include the file with the code of the element */
|
/* include the file with the code of the element */
|
||||||
put '%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;' /;
|
put '%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;' /;
|
||||||
|
|
||||||
/* FOOTERS for IML and FCMP */
|
/* FOOTERS for IML, FCMP, and PROTO */
|
||||||
if 1 = LAST.type and upcase(type)='FUNCTIONS' then /* footer, for multiple functions in one FCMP run */
|
if 1 = LAST.type and upcase(type)='FUNCTIONS' then /* footer, for multiple functions in one FCMP run */
|
||||||
do;
|
do;
|
||||||
put "run; ";
|
put "run; ";
|
||||||
@@ -1681,11 +1751,17 @@ data _null_;
|
|||||||
put "store module = _ALL_; "; /* and store all created modules */
|
put "store module = _ALL_; "; /* and store all created modules */
|
||||||
put "quit; ";
|
put "quit; ";
|
||||||
end;
|
end;
|
||||||
|
if 1 = LAST.type and upcase(type)='PROTO' then /* footer, for multiple functions in one PROTO run */
|
||||||
|
do;
|
||||||
|
put "run; ";
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
isFunction + (upcase(type)=:'FUNCTION');
|
isFunction + (upcase(type)=:'FUNCTION');
|
||||||
isFormat + (upcase(type)=:'FORMAT');
|
isFormat + (upcase(type)=:'FORMAT');
|
||||||
|
isProto + (upcase(type)=:'PROTO');
|
||||||
|
|
||||||
/* add the link to the functions' dataset, only for the first occurrence */
|
/* add the link to the functions dataset, only for the first occurrence */
|
||||||
if 1 = isFunction and (upcase(type)=:'FUNCTION') then
|
if 1 = isFunction and (upcase(type)=:'FUNCTION') then
|
||||||
do;
|
do;
|
||||||
put "options APPEND=(cmplib = work.%lowcase(&packageName.fcmp));";
|
put "options APPEND=(cmplib = work.%lowcase(&packageName.fcmp));";
|
||||||
@@ -1693,7 +1769,15 @@ data _null_;
|
|||||||
put '%put NOTE:[CMPLIB] %sysfunc(getoption(cmplib));' /;
|
put '%put NOTE:[CMPLIB] %sysfunc(getoption(cmplib));' /;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
/* add the link to the formats' catalog, only for the first occurrence */
|
/* add the link to the proto functions dataset, only for the first occurrence */
|
||||||
|
if 1 = isProto and (upcase(type)=:'PROTO') then
|
||||||
|
do;
|
||||||
|
put "options APPEND=(cmplib = work.%lowcase(&packageName.proto));";
|
||||||
|
put '%put NOTE- ;';
|
||||||
|
put '%put NOTE:[CMPLIB] %sysfunc(getoption(cmplib));' /;
|
||||||
|
end;
|
||||||
|
|
||||||
|
/* add the link to the formats catalog, only for the first occurrence */
|
||||||
if 1 = isFormat and (upcase(type)=:'FORMAT') then
|
if 1 = isFormat and (upcase(type)=:'FORMAT') then
|
||||||
do;
|
do;
|
||||||
put "options INSERT=( fmtsearch = work.%lowcase(&packageName.format) );";
|
put "options INSERT=( fmtsearch = work.%lowcase(&packageName.format) );";
|
||||||
@@ -1769,14 +1853,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;
|
||||||
|
|
||||||
put 'if lazyData="*" OR findw(lazyData, "' fileshort +(-1) '") then';
|
if ( upcase(type) =: 'LAZYDATA' ) then
|
||||||
put 'do;';
|
do;
|
||||||
put ' put "NOTE- Dataset ' fileshort 'from the file ""' file +(-1) '"" will be loaded";';
|
put 'if lazyData="*" OR findw(lazyData, "' fileshort +(-1) '") then';
|
||||||
put ' call execute(''%nrstr(%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;)'');';
|
put 'do;';
|
||||||
put 'end;';
|
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 'end;';
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
put 'run;';
|
put 'run;';
|
||||||
|
|
||||||
put '%put NOTE- ;';
|
put '%put NOTE- ;';
|
||||||
@@ -1890,6 +1978,31 @@ data _null_;
|
|||||||
put '%put NOTE:[FMTSEARCH] %sysfunc(getoption(fmtsearch));' /;
|
put '%put NOTE:[FMTSEARCH] %sysfunc(getoption(fmtsearch));' /;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
/* delete proto functions */
|
||||||
|
isProto = 0;
|
||||||
|
EOF = 0;
|
||||||
|
do until(EOF);
|
||||||
|
set &filesWithCodes. end = EOF;
|
||||||
|
if not (upcase(type)=:'PROTO') then continue;
|
||||||
|
put '%put NOTE- Element of type ' type 'generated from the file "' file +(-1) '" will be deleted;';
|
||||||
|
put '%put NOTE- ;' /;
|
||||||
|
isProto + 1;
|
||||||
|
end;
|
||||||
|
/* delete the link to the proto functions dataset */
|
||||||
|
if isProto then
|
||||||
|
do;
|
||||||
|
put "proc delete data = work.%lowcase(&packageName.proto);";
|
||||||
|
put "run;" /;
|
||||||
|
put 'options cmplib = (%unquote(%sysfunc(tranwrd(' /
|
||||||
|
'%lowcase(%sysfunc(getoption(cmplib)))' /
|
||||||
|
',%str(' "work.%lowcase(&packageName.proto)" '), %str() ))));';
|
||||||
|
put 'options cmplib = (%unquote(%sysfunc(compress(' /
|
||||||
|
'%sysfunc(getoption(cmplib))' /
|
||||||
|
',%str(()) ))));';
|
||||||
|
put '%put; %put NOTE:[CMPLIB] %sysfunc(getoption(cmplib));' /;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
/* delete functions */
|
/* delete functions */
|
||||||
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package;";
|
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package;";
|
||||||
isFunction = 0;
|
isFunction = 0;
|
||||||
@@ -2030,16 +2143,16 @@ data _null_;
|
|||||||
put 'options ls = MAX ps = MAX nonotes nosource; ';
|
put 'options ls = MAX ps = MAX nonotes nosource; ';
|
||||||
put '%include' " &_PackageFileref_.(packagemetadata.sas) / nosource2; " /;
|
put '%include' " &_PackageFileref_.(packagemetadata.sas) / nosource2; " /;
|
||||||
|
|
||||||
put 'data _null_; ';
|
put 'data _null_; ';
|
||||||
put ' if strip(symget("helpKeyword")) = " " then ';
|
put ' if strip(symget("helpKeyword")) = " " then ';
|
||||||
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; ';
|
||||||
|
|
||||||
|
|
||||||
put ' put ; put " Package contains: "; ';
|
put ' put ; put " Package contains: "; ';
|
||||||
@@ -2074,7 +2187,7 @@ data _null_;
|
|||||||
put ' end ; ';
|
put ' end ; ';
|
||||||
%end;
|
%end;
|
||||||
|
|
||||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20200807 *"; put "***";';
|
put 'put "***"; put "* SAS package generated by generatePackage, version 20200811 *"; put "***";';
|
||||||
|
|
||||||
put 'run; ' /;
|
put 'run; ' /;
|
||||||
|
|
||||||
@@ -2112,9 +2225,11 @@ data _null_;
|
|||||||
|
|
||||||
select;
|
select;
|
||||||
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
|
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
|
||||||
when (upcase(type) = "MACRO") fileshort2 = cats('%',fileshort,'()');
|
when (upcase(type) = "MACRO") fileshort2 = cats('''%',fileshort,'()''');
|
||||||
when (upcase(type) =:"FUNCTION") fileshort2 = cats(fileshort,'()');
|
when (upcase(type) =:"FUNCTION") fileshort2 = cats("'",fileshort,"()'");
|
||||||
when (upcase(type) = "FORMAT") fileshort2 = cats('$',fileshort);
|
when (upcase(type) =:"IMLMODULE") fileshort2 = cats("'",fileshort,"()'");
|
||||||
|
when (upcase(type) =:"PROTO") fileshort2 = cats("'",fileshort,"()'");
|
||||||
|
when (upcase(type) = "FORMAT") fileshort2 = cats("'$",fileshort,".'");
|
||||||
otherwise fileshort2 = fileshort;
|
otherwise fileshort2 = fileshort;
|
||||||
end;
|
end;
|
||||||
strX = catx('/', folder, order, type, file, fileshort, fileshort2);
|
strX = catx('/', folder, order, type, file, fileshort, fileshort2);
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ run;
|
|||||||
%end;
|
%end;
|
||||||
```
|
```
|
||||||
|
|
||||||
- **BasePlus**\[0.52\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
- **BasePlus**\[0.53\] 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);
|
||||||
@@ -72,7 +72,7 @@ string = catXFn("date9.", "#", myArray);
|
|||||||
|
|
||||||
format x bool.;
|
format x bool.;
|
||||||
|
|
||||||
%put %getVars(sashelp.class, patern = ght$, sep = +, varRange = _numeric_);
|
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||||
```
|
```
|
||||||
|
|
||||||
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
||||||
|
|||||||
Binary file not shown.
BIN
packages/dfa.zip
BIN
packages/dfa.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user