Compare commits

...

14 Commits

Author SHA1 Message Date
yabwon
4eac2a0fea Merge branch 'master' of https://github.com/yabwon/SAS_PACKAGES 2020-08-15 13:18:06 +02:00
yabwon
ad81e0cb0e version 20200815
version 20200815, changes:
- Type PROTO added in the `%genaratePackge()` macro. Functions generated by Proc Proto in `externC functionName;` and `externCend;` blocks are available.
- Bug fix in the `%listPackages()` macro.
- Documentation updated.
2020-08-15 13:17:57 +02:00
yabwon
f542d70332 Getting Started with SAS Packages
recompiled with new version of the framework
2020-08-12 14:45:20 +02:00
yabwon
80fdc9f214 version 0.3
recompiled with new version of the framework
2020-08-12 14:43:05 +02:00
yabwon
f23afe7486 version 0.2
recompiled with new version of the framework
2020-08-12 14:42:48 +02:00
yabwon
e467959d77 version 2.1
recompiled with new version of the framework
2020-08-12 14:42:14 +02:00
yabwon
035e184b74 version v0.53
bug fixes and recompiled with new version of the framework
2020-08-12 14:41:48 +02:00
yabwon
61d5806e79 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
- help section search improved
- documentation updated.
2020-08-12 14:29:47 +02:00
yabwon
98871647dd Getting Started with SAS Packages
*BasePlus* 0.53
2020-08-12 13:56:35 +02:00
yabwon
16b744a763 version 20200811 2020-08-12 13:55:35 +02:00
yabwon
4765dc5c43 Getting Started with SAS Packages
BasePlus v0.53
2020-08-12 13:54:19 +02:00
yabwon
e1c95da0b7 version 20200811 2020-08-12 13:53:06 +02:00
yabwon
319dd8c46b Merge branch 'master' of https://github.com/yabwon/SAS_PACKAGES 2020-08-12 13:52:06 +02:00
yabwon
96555584a3 version 0.53
bug fix in the %getVars() and %QgetVars() macros
2020-08-12 13:52:02 +02:00
9 changed files with 85 additions and 35 deletions

View File

@@ -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.
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`.
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).
@@ -88,7 +88,7 @@ run;
%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 arrFillMiss(17, myArray);
@@ -100,7 +100,7 @@ string = catXFn("date9.", "#", myArray);
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)

View File

@@ -884,14 +884,14 @@ data _null_;
stop;
end;
length folder file $ 256 folderRef fileRef $ 8;
length folder $ 64 file $ 1024 folderRef fileRef $ 8;
folderRef = "_%sysfunc(datetime(), hex6.)0";
rc=filename(folderRef, base);
folderid=dopen(folderRef);
put;
putlog " ";
put "/*" 100*"+" ;
do i=1 to dnum(folderId); drop i;
folder = dread(folderId, i);
@@ -903,31 +903,36 @@ data _null_;
EOF = 0;
if fileId = 0 and lowcase(scan(folder, -1, ".")) = 'zip' then
do;
file = catx('/',base, folder);
length nn $ 96;
nn = repeat("*", (96-lengthn(file)));
putlog " ";
put " * " file @; put nn /;
infile package ZIP FILEVAR=file member="description.sas" end=EOF;
do until(EOF);
input;
if lowcase(scan(_INFILE_,1,":")) in ("package" "title" "version" "author" "maintainer" "license") then
do;
_INFILE_ = scan(_INFILE_,1,":") !! ":" !! scan(_INFILE_,2,":");
putlog " * " _INFILE_;
end;
if upcase(strip(_INFILE_)) =: "DESCRIPTION START:" then leave;
end;
putlog " * ";
file = catx('/',base, folder);
length nn $ 96;
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;
do until(EOF);
input;
if lowcase(scan(_INFILE_,1,":")) in ("package" "title" "version" "author" "maintainer" "license") then
do;
_INFILE_ = scan(_INFILE_,1,":") !! ":" !! scan(_INFILE_,2,":");
putlog " * " _INFILE_;
end;
if upcase(strip(_INFILE_)) =: "DESCRIPTION START:" then leave;
end;
end;
rc = dclose(fileId);
rc = filename(fileRef);
end;
putlog " ";
putlog " * ";
put 100*"+" "*/";
rc = dclose(folderid);
rc = filename(folderRef);
@@ -1695,7 +1700,7 @@ data _null_;
*/
/* test for supported types */
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
do;
putlog 'WARNING: Type ' type 'is not yet supported.';
@@ -1718,11 +1723,15 @@ data _null_;
put '%put NOTE- ;';
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 */
do;
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package; ";
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 */
do;
put "proc iml; ";
@@ -1731,7 +1740,7 @@ data _null_;
/* include the file with the code of the element */
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 */
do;
put "run; ";
@@ -1742,11 +1751,17 @@ data _null_;
put "store module = _ALL_; "; /* and store all created modules */
put "quit; ";
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');
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
do;
put "options APPEND=(cmplib = work.%lowcase(&packageName.fcmp));";
@@ -1754,7 +1769,15 @@ data _null_;
put '%put NOTE:[CMPLIB] %sysfunc(getoption(cmplib));' /;
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
do;
put "options INSERT=( fmtsearch = work.%lowcase(&packageName.format) );";
@@ -1955,6 +1978,31 @@ data _null_;
put '%put NOTE:[FMTSEARCH] %sysfunc(getoption(fmtsearch));' /;
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 */
put "proc fcmp outlib = work.%lowcase(&packageName.fcmp).package;";
isFunction = 0;
@@ -2177,9 +2225,11 @@ data _null_;
select;
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
when (upcase(type) = "MACRO") fileshort2 = cats('%',fileshort,'()');
when (upcase(type) =:"FUNCTION") fileshort2 = cats(fileshort,'()');
when (upcase(type) = "FORMAT") fileshort2 = cats('$',fileshort);
when (upcase(type) = "MACRO") fileshort2 = cats('''%',fileshort,'()''');
when (upcase(type) =:"FUNCTION") 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;
end;
strX = catx('/', folder, order, type, file, fileshort, fileshort2);

View File

@@ -1,7 +1,7 @@
## 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:
- **SQLinDS**\[2.1\], based on Mike Rhoads' article *Use the Full Power of SAS in Your Function-Style Macros*. The package allows to write SQL queries in the data step, e.g.
@@ -60,7 +60,7 @@ run;
%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 arrFillMiss(17, myArray);
@@ -72,7 +72,7 @@ string = catXFn("date9.", "#", myArray);
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)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.