mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2025-12-11 11:14:35 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba4a49f95f | ||
|
|
e00353e693 | ||
|
|
7c1d58c165 | ||
|
|
02f71de424 | ||
|
|
bfdcd238ec |
14
README.md
14
README.md
@@ -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 **`20201014`**.
|
||||
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20201018`**.
|
||||
|
||||
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).
|
||||
|
||||
@@ -79,16 +79,16 @@ Currently the following packages are available (see the `./packages` directory):
|
||||
set %SQL(select * from sashelp.class order by age);
|
||||
run;
|
||||
```
|
||||
SHA256 digest for SQLinDS: F070926B26504F9F65384EE3FB84E2E54B223FDAB71EDD61B11B865262C2E5DD
|
||||
SHA256 digest for SQLinDS: 135DC50C0412B8CEAF6D5349B8A203C0ADB23D4F5C2680B6A35FD2E5482B6C49
|
||||
|
||||
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/sqlinds.md "Documentation for SQLinDS")
|
||||
|
||||
- **DFA** (Dynamic Function Arrays)\[0.2\], contains set of macros and FCMP functions which implement: a dynamically allocated array, a stack, a fifo queue, an ordered stack, and a priority queue, run `%helpPackage(DFA,createDFArray)` to find examples.
|
||||
|
||||
SHA256 digest for DFA: 7E9042867ED9C4BD2F27B3CD9180701CE619E301C13F5BD82DB46547616D17DF
|
||||
SHA256 digest for DFA: E67A0863992722A5F535F56E14EF8D19A55F74FB374447BF11B5ED74029C29CB
|
||||
|
||||
|
||||
- **macroArray**\[0.5\], implementation of an array concept in a macrolanguage, e.g.
|
||||
- **macroArray**\[0.6\], implementation of an array concept in a macrolanguage, e.g.
|
||||
```
|
||||
%array(ABC[17] (111:127), macarray=Y);
|
||||
|
||||
@@ -107,7 +107,7 @@ SHA256 digest for DFA: 7E9042867ED9C4BD2F27B3CD9180701CE619E301C13F5BD82DB465476
|
||||
which = 1:H:2
|
||||
);
|
||||
```
|
||||
SHA256 digest for macroArray: 519B1CE64F66F8498B10F5EB253BB45FC860E3F7868FCEB97ABF45C96F30716D
|
||||
SHA256 digest for macroArray: 42771AA7CD2A0608E1EE25F104F21CCCC296919910E4BCA7AD9AE46A291BB8D7
|
||||
|
||||
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/macroarray.md "Documentation for macroArray")
|
||||
|
||||
@@ -126,12 +126,12 @@ format x bool.;
|
||||
|
||||
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||
```
|
||||
SHA256 digest for BasePlus: 75B8D2BF718E035FEFC0D24504A6EBB9893883E2DF5D0FCD2D8ADD28456CFEBD
|
||||
SHA256 digest for BasePlus: BDEA8AA6EED9739284ABF8297BEC7EC0F12490D72EF9B685F477E99AFA734B82
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
||||
|
||||
SHA256 digest for dynMacroArray: FF111DA330ACE57BAE8C9B7890839045B691A17414AE04CBD49C66BCD9663B21
|
||||
SHA256 digest for dynMacroArray: 694AACE925B7F4E149C3B90383F56370ED76233D8F5040713D66C1F3A4E414FE
|
||||
|
||||
### ======
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,32 +1,43 @@
|
||||
## This is short SAS PAckages Framework help information
|
||||
|
||||
- [SAS PAckages Framework help](#helpinfo)
|
||||
* [the `installPackage` macro](#installpackage)
|
||||
* [the `helpPackage` macro](#helppackage)
|
||||
* [the `loadPackage` macro](#loadpackage)
|
||||
* [the `loadPackageS` macro](#loadpackages)
|
||||
* [the `unloadPackage` macro](#unloadpackage)
|
||||
* [the `listPackages` macro](#listpackages)
|
||||
* [the `verifyPackage` macro](#verifypackage)
|
||||
* [the `generatePackage` macro](#generatepackage)
|
||||
* [Some more examples](#some-more-examples)
|
||||
|
||||
---
|
||||
|
||||
|
||||
## This is short SAS PAckages Framework help information <a name="helpinfo"></a>
|
||||
|
||||
A **SAS package** is an automatically generated, single, stand alone *zip* file containing organised and ordered code structures, created by the developer and extended with additional automatically generated "driving" files (i.e. description, metadata, load, unload, and help files).
|
||||
|
||||
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 **`20201014`**.
|
||||
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20201018`**.
|
||||
|
||||
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).
|
||||
|
||||
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).
|
||||
**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).
|
||||
|
||||
|
||||
*Note:* Filenames references `packages` and `package` are reserved keywords.
|
||||
The first one should be used to point local folder with packages.
|
||||
The first one should be used to point local folder with packages and the framework.
|
||||
The second is used internally by macros.
|
||||
Do not use them otherwise than, e.g.
|
||||
|
||||
`filename packages "C:/SAS_PACKAGES";`
|
||||
|
||||
since it may affect stability of the framework.
|
||||
After assigning the directory do not change them when using the SPF since it may affect stability of the framework.
|
||||
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
## This is short help information for the `installPackage` macro
|
||||
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
Macro to install SAS packages, version `20201010`
|
||||
Macro to install SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -48,12 +59,9 @@ since it may affect stability of the framework.
|
||||
If the package name is *SPFinit* or *SASPackagesFramework*
|
||||
then the framework itself is downloaded.
|
||||
|
||||
- `sourcePath=` Location of the package, e.g. "www.some.web.page/"
|
||||
Mind the "/" at the end of the path!
|
||||
Current default location for packages is:
|
||||
`https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/master/packages/`
|
||||
Current default location for the framework is:
|
||||
`https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/master/SPF/`
|
||||
- `sourcePath=` Location of the package, e.g. "www.some.web.page/" (mind the "/" at the end of the path!) <br>
|
||||
Current default location for packages is: <br> `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/master/packages/` <br>
|
||||
Current default location for the framework is: <br> `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/master/SPF/`
|
||||
|
||||
- `replace=` With default value of `1` it causes existing package file
|
||||
to be replaceed by new downloaded file.
|
||||
@@ -83,10 +91,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
## This is short help information for the `helpPackage` macro
|
||||
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to get help about SAS packages, version `20201010`
|
||||
Macro to get help about SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -153,10 +161,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
## This is short help information for the `loadPackage` macro
|
||||
## This is short help information for the `loadPackage` macro <a name="loadpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *load* SAS packages, version `20201010`
|
||||
Macro to *load* SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -226,10 +234,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
## This is short help information for the `loadPackageS` macro
|
||||
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro wrapper for the loadPackage macro, version `20201010`
|
||||
Macro wrapper for the loadPackage macro, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -275,10 +283,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
|
||||
|
||||
|
||||
## This is short help information for the `unloadPackage` macro
|
||||
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to unload SAS packages, version `20201010`
|
||||
Macro to unload SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -340,10 +348,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
## This is short help information for the `listPackages` macro
|
||||
## This is short help information for the `listPackages` macro <a name="listpackages"></a>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to list available SAS packages, version `20201010`
|
||||
Macro to list available SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -381,10 +389,10 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
### This is short help information for the `verifyPackage` macro
|
||||
## This is short help information for the `verifyPackage` macro <a name="verifypackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to verify SAS package with it hash digest, version `20201010`
|
||||
Macro to verify SAS package with it hash digest, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -434,10 +442,10 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
|
||||
hash=HDA478ANJ3HKHRY327FGE88HF89VH89HFFFV73GCV98RF390VB4)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
## This is short help information for the `generatePackage` macro
|
||||
## This is short help information for the `generatePackage` macro <a name="generatepackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to generate SAS packages, version `20201010`
|
||||
Macro to generate SAS packages, version `20201018`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -467,6 +475,9 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
|
||||
- `packages=` Location of other packages for testing
|
||||
if there are dependencies in loading the package.
|
||||
|
||||
- `testResults=` Location where tests results should be stored,
|
||||
if null (the default) then the session WORK is used.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Locate all files with code in base folder, i.e. at `filesLocation` directory.
|
||||
@@ -588,7 +599,7 @@ The "tree structure" of the folder could be for example as follows:
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
## Some more examples #############################################################
|
||||
## Some more examples <a name="some-more-examples"></a> #############################################################
|
||||
|
||||
### Example 1. ###################################################################
|
||||
Enabling the SAS Package Framework
|
||||
|
||||
168
SPF/SPFinit.sas
168
SPF/SPFinit.sas
@@ -42,7 +42,7 @@
|
||||
- to unload, or
|
||||
- to generate SAS packages.
|
||||
|
||||
Version 20201014.
|
||||
Version 20201018.
|
||||
See examples below.
|
||||
|
||||
A SAS package is a zip file containing a group of files
|
||||
@@ -81,7 +81,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load SAS package, version 20201014. Run %loadPackage() for help info.'
|
||||
des = 'Macro to load SAS package, version 20201018. Run %loadPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -96,7 +96,7 @@ des = 'Macro to load SAS package, version 20201014. Run %loadPackage() for help
|
||||
%put ### This is short help information for the `loadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* SAS packages, version `20201014` #;
|
||||
%put # Macro to *load* SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -250,7 +250,7 @@ des = 'Macro to load SAS package, version 20201014. Run %loadPackage() for help
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to unload SAS package, version 20201014. Run %unloadPackage() for help info.'
|
||||
des = 'Macro to unload SAS package, version 20201018. Run %unloadPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -265,7 +265,7 @@ des = 'Macro to unload SAS package, version 20201014. Run %unloadPackage() for h
|
||||
%put ### This is short help information for the `unloadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to unload SAS packages, version `20201014` #;
|
||||
%put # Macro to unload SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -388,7 +388,7 @@ des = 'Macro to unload SAS package, version 20201014. Run %unloadPackage() for h
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to get help about SAS package, version 20201014. Run %helpPackage() for help info.'
|
||||
des = 'Macro to get help about SAS package, version 20201018. Run %helpPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -403,7 +403,7 @@ des = 'Macro to get help about SAS package, version 20201014. Run %helpPackage()
|
||||
%put ### This is short help information for the `helpPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get help about SAS packages, version `20201014` #;
|
||||
%put # Macro to get help about SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -512,7 +512,7 @@ TODO:
|
||||
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
|
||||
*/
|
||||
|
||||
/* Macros to install SAS packages, version 20201014 */
|
||||
/* Macros to install SAS packages, version 20201018 */
|
||||
/* A SAS package is a zip file containing a group of files
|
||||
with SAS code (macros, functions, data steps generating
|
||||
data, etc.) wrapped up together and %INCLUDEed by
|
||||
@@ -528,7 +528,7 @@ TODO:
|
||||
/secure
|
||||
minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to install SAS package, version 20201014. Run %%installPackage() for help info.'
|
||||
des = 'Macro to install SAS package, version 20201018. Run %%installPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
%do;
|
||||
@@ -543,7 +543,7 @@ des = 'Macro to install SAS package, version 20201014. Run %%installPackage() fo
|
||||
%put ### This is short help information for the `installPackage` macro #;
|
||||
%put #--------------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to install SAS packages, version `20201014` #;
|
||||
%put # Macro to install SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -836,7 +836,7 @@ des = 'Macro to install SAS package, version 20201014. Run %%installPackage() fo
|
||||
|
||||
/* Macro to list SAS packages in packages folder.
|
||||
|
||||
Version 20201014
|
||||
Version 20201018
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -856,7 +856,7 @@ des = 'Macro to install SAS package, version 20201014. Run %%installPackage() fo
|
||||
|
||||
|
||||
%macro listPackages()/PARMBUFF
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20201014.'
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20201018.'
|
||||
;
|
||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
||||
%do;
|
||||
@@ -871,7 +871,7 @@ des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HE
|
||||
%put ### This is short help information for the `listPackages` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list available SAS packages, version `20201014` #;
|
||||
%put # Macro to list available SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -1002,7 +1002,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
|
||||
/* Macro to generate SAS packages.
|
||||
|
||||
Version 20201014
|
||||
Version 20201018
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1023,10 +1023,11 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
default value Y means "execute tests" */
|
||||
,packages= /* location of other packages if there are
|
||||
dependencies in loading */
|
||||
)/secure
|
||||
,testResults= /* location where tests results should be stored,
|
||||
if null (the default) the WORK is used */
|
||||
)/secure minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to generate SAS packages, version 20201014. Run %generatePackage() for help info.'
|
||||
minoperator
|
||||
des = 'Macro to generate SAS packages, version 20201018. Run %generatePackage() for help info.'
|
||||
;
|
||||
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
|
||||
%do;
|
||||
@@ -1041,7 +1042,7 @@ minoperator
|
||||
%put ### This is short help information for the `generatePackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to generate SAS packages, version `20201014` #;
|
||||
%put # Macro to generate SAS packages, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -1071,6 +1072,9 @@ minoperator
|
||||
%put # - `packages=` Location of other packages for testing #;
|
||||
%put # if there are dependencies in loading the package. #;
|
||||
%put # #;
|
||||
%put # - `testResults=` Location where tests results should be stored, #;
|
||||
%put # if null (the default) then the session WORK is used. #;
|
||||
%put # #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put #################################################################################;
|
||||
%put ;
|
||||
@@ -1931,7 +1935,7 @@ data _null_;
|
||||
|
||||
put "filename &_PackageFileref_. list;" /;
|
||||
put ' %put NOTE- ;';
|
||||
put ' %put NOTE: ' @; put "Lazy data for package &packageName., version &packageVersion., license &packageLicense.; ";
|
||||
put ' %put NOTE: ' @; put "Data for package &packageName., version &packageVersion., license &packageLicense.; ";
|
||||
put ' %put NOTE: ' @; put "*** &packageTitle. ***; ";
|
||||
put ' %put NOTE- ' @; put "Generated: %sysfunc(datetime(), datetime21.); ";
|
||||
put ' %put NOTE- ' @; put "Author(s): &packageAuthor.; ";
|
||||
@@ -1956,12 +1960,21 @@ data _null_;
|
||||
put ' call execute(''%nrstr(%include' " &_PackageFileref_.(_" folder +(-1) "." file +(-1) ') / nosource2;)'');';
|
||||
put 'end;';
|
||||
end;
|
||||
/* use lazyData to reload data type */
|
||||
if ( upcase(type) =: 'DATA' ) then
|
||||
do;
|
||||
put 'if findw(lazyData, "' fileshort +(-1) '") then';
|
||||
put 'do;';
|
||||
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;
|
||||
|
||||
put 'run;';
|
||||
|
||||
put '%put NOTE- ;';
|
||||
put '%put NOTE: '"Lazy data for package &packageName., version &packageVersion., license &packageLicense.;";
|
||||
put '%put NOTE: '"Data for package &packageName., version &packageVersion., license &packageLicense.;";
|
||||
put '%put NOTE- *** END ***;' /;
|
||||
put "/* lazydata.sas end */" /;
|
||||
stop;
|
||||
@@ -2242,7 +2255,7 @@ data _null_;
|
||||
put " infile &_PackageFileref_.(description.sas) end = EOF; ";
|
||||
put ' input; ';
|
||||
put ' if upcase(strip(_infile_)) =: "DESCRIPTION END:" then printer = 0; ';
|
||||
put ' if printer then put @1 _infile_; ';
|
||||
put ' if printer then put "| " _infile_; ';
|
||||
put ' if upcase(strip(_infile_)) =: "DESCRIPTION START:" then printer = 1; ';
|
||||
put ' end; ';
|
||||
put ' else stop; ';
|
||||
@@ -2255,7 +2268,7 @@ data _null_;
|
||||
set &filesWithCodes. end = EOFDS nobs = NOBS curobs = CUROBS;
|
||||
if upcase(type) in: ('TEST') then continue; /* exclude tests */
|
||||
|
||||
put 'put @5 "' CUROBS +(-1) ')" @10 "' type '" @21 "' fileshort '";';
|
||||
put 'put @5 "' CUROBS +(-1) '." @10 "' type '" @21 "' fileshort '";';
|
||||
end;
|
||||
|
||||
%if %bquote(&packageRequired.) ne %then
|
||||
@@ -2280,7 +2293,7 @@ data _null_;
|
||||
put ' end ; ';
|
||||
%end;
|
||||
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20201014 *"; put "***";';
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20201018 *"; put "***";';
|
||||
|
||||
put 'run; ' /;
|
||||
|
||||
@@ -2290,7 +2303,7 @@ data _null_;
|
||||
put ' do until (EOF); ';
|
||||
put " infile &_PackageFileref_.(license.sas) end = EOF; ";
|
||||
put ' input; ';
|
||||
put ' put @1 _infile_; ';
|
||||
put ' put "| " _infile_; ';
|
||||
put ' end; ';
|
||||
put ' else stop; ';
|
||||
put 'run; ' /;
|
||||
@@ -2317,8 +2330,8 @@ data _null_;
|
||||
if upcase(type) in: ('TEST') then continue; /* exclude tests */
|
||||
|
||||
select;
|
||||
when (upcase(type) in ("DATA" "LAZYDATA")) fileshort2 = fileshort;
|
||||
when (upcase(type) = "MACRO" ) fileshort2 = cats('''%', fileshort, '()''');
|
||||
when (upcase(type) in ("DATA" "LAZYDATA")) 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, "()'" );
|
||||
@@ -2342,29 +2355,31 @@ data _null_;
|
||||
'put; put '' *> No help info found. Try %helpPackage(packageName,*) to display all.''; put; stop; ' /
|
||||
'end; ';
|
||||
put ' do until(EOFDS); ';
|
||||
put ' set WORK._last_ end = EOFDS nobs = NOBS; ';
|
||||
put ' length memberX $ 1024; ';
|
||||
put ' memberX = cats("_",folder,".",file); ';
|
||||
put ' set WORK._last_ end = EOFDS nobs = NOBS; ';
|
||||
put ' length memberX $ 1024; ';
|
||||
put ' memberX = cats("_",folder,".",file); ';
|
||||
/* inner data step in call execute to read each embedded file */
|
||||
put ' call execute("data _null_; ");';
|
||||
put " call execute('infile &_PackageFileref_.(' || strip(memberX) || ') end = EOF; ');";
|
||||
put ' call execute(" printer = 0; ");';
|
||||
put ' call execute(" do until(EOF); ");';
|
||||
put ' call execute(" input; ");';
|
||||
put ' call execute(" if upcase(strip(_infile_)) ';
|
||||
put ' = ''/*** HELP END ***/'' then printer = 0; ");';
|
||||
put ' call execute(" if printer then put ""| "" _infile_; ");';
|
||||
put ' call execute(" if upcase(strip(_infile_)) ';
|
||||
put ' = ''/*** HELP START ***/'' then printer = 1; ");';
|
||||
put ' call execute(" end; ");';
|
||||
put ' call execute(" put "" "" / "" ""; ");';
|
||||
put ' call execute(" stop; ");';
|
||||
put ' call execute("run; ");';
|
||||
put ' if lowcase(type) =: "data" then ';
|
||||
put ' do; ';
|
||||
put ' call execute("title ""Dataset " || strip(fileshort) || " from package &packageName. ""; ");';
|
||||
put ' call execute("proc contents data = " || strip(fileshort) || "; run; title; ");';
|
||||
put ' end; ';
|
||||
put ' call execute("data _null_; ");';
|
||||
put " call execute('infile &_PackageFileref_.(' || strip(memberX) || ') end = EOF; ');";
|
||||
put ' call execute(" printer = 0; ");';
|
||||
put ' call execute(" do until(EOF); ");';
|
||||
put ' call execute(" input; ");';
|
||||
put ' call execute(" if upcase(strip(_infile_)) ';
|
||||
put ' = ''/*** HELP END ***/'' then printer = 0; ");';
|
||||
put ' call execute(" if printer then put ""| "" _infile_; ");';
|
||||
put ' call execute(" if upcase(strip(_infile_)) ';
|
||||
put ' = ''/*** HELP START ***/'' then printer = 1; ");';
|
||||
put ' call execute(" end; ");';
|
||||
put ' call execute(" put "" "" / "" ""; ");';
|
||||
put ' call execute(" stop; ");';
|
||||
put ' call execute("run; ");';
|
||||
put ' if lowcase(type) in ("data" "lazydata") then ';
|
||||
put ' do; ';
|
||||
put ' call execute("title ""Dataset " || strip(fileshort) || " from package &packageName. ""; ");';
|
||||
put ' if exist(fileshort) then call execute("proc contents data = " || strip(fileshort) || "; run; ");';
|
||||
put ' else call execute("data _null_; put ""| Dataset " || strip(fileshort) || " does not exist.""; run;");';
|
||||
put ' call execute("title; ");';
|
||||
put ' end; ';
|
||||
/**/
|
||||
put " end; ";
|
||||
put " stop; ";
|
||||
@@ -2486,13 +2501,25 @@ filename sasroot;
|
||||
%let SASWORK=%sysfunc(GETOPTION(work));
|
||||
%put *&SASWORK.*;
|
||||
|
||||
options DLCREATEDIR; /* turns-on creation of subdirectories */
|
||||
/* temporary location for tests results */
|
||||
libname TEST "&SASWORK./test_%lowcase(%sysfunc(datetime(),b8601dt19.))";
|
||||
libname TESTWORK "%sysfunc(pathname(TEST))/work";
|
||||
%local dirForTest;
|
||||
%let dirForTest = %sysfunc(pathname(TEST));
|
||||
|
||||
options DLCREATEDIR; /* turns-on creation of subdirectories by libname */
|
||||
/* temporary location for tests results is WORK unless developer provide &testResults. */
|
||||
%local testPackageTimesamp;
|
||||
%let testPackageTimesamp = %lowcase(&packageName._%sysfunc(datetime(),b8601dt15.));
|
||||
%if %qsysfunc(fileexist(%bquote(&testResults.))) %then
|
||||
%do;
|
||||
libname TEST "&testResults./test_&testPackageTimesamp.";
|
||||
%end;
|
||||
%else
|
||||
%do;
|
||||
libname TEST "&SASWORK./test_&testPackageTimesamp.";
|
||||
%end;
|
||||
/* test work points to the SAS session work */
|
||||
libname TESTWORK "&SASWORK./testwork_&testPackageTimesamp.";
|
||||
%local dirForTest dirForTestWork;
|
||||
%let dirForTest = %sysfunc(pathname(TEST));
|
||||
%let dirForTestWork = %sysfunc(pathname(TESTWORK));
|
||||
%put &=dirForTest.;
|
||||
%put &=dirForTestWork.;
|
||||
|
||||
/* remember location of sessions current directory */
|
||||
filename currdir ".";
|
||||
@@ -2514,6 +2541,12 @@ filename currdir list;
|
||||
%put NOTE: changing current folder to:;
|
||||
%put *%sysfunc(DLGCDIR(&dirForTest.))*;
|
||||
|
||||
|
||||
/* turn off the note about quoted string length */
|
||||
%local quotelenmax_tmp;
|
||||
%let quotelenmax_tmp = %sysfunc(getoption(quotelenmax));
|
||||
options NOquotelenmax;
|
||||
|
||||
/* the first test is for loading package, testing help and unloading */
|
||||
/*-1-*/
|
||||
data _null_;
|
||||
@@ -2529,6 +2562,8 @@ data _null_;
|
||||
/* load */
|
||||
put '%loadpackage'"(&packageName.,";
|
||||
put " path=&filesLocation.)" /;
|
||||
put '%loadpackage'"(&packageName.,";
|
||||
put " path=&filesLocation., lazyData=*)" /;
|
||||
|
||||
/* help */
|
||||
put '%helpPackage'"(&packageName.,";
|
||||
@@ -2552,6 +2587,8 @@ setup for testing session:
|
||||
-work - location for work
|
||||
-noterminal - for batch execution mode
|
||||
-rsasuser - to avoid the "Unable to copy SASUSER registry to WORK registry." warning
|
||||
-linesize - MAX
|
||||
-pagesize - MAX
|
||||
*/
|
||||
systask kill sas0 wait;
|
||||
%local sasstat0 TEST_0 TESTRC_0;;
|
||||
@@ -2562,9 +2599,9 @@ systask command
|
||||
-print ""&dirForTest./&TEST_0..lst""
|
||||
-log ""&dirForTest./&TEST_0..log""
|
||||
-config ""&SASROOT./sasv9.cfg""
|
||||
-work ""&dirForTest./work""
|
||||
-work ""&dirForTestWork.""
|
||||
-noterminal
|
||||
-rsasuser"
|
||||
-rsasuser -linesize MAX -pagesize MAX"
|
||||
taskname=sas0
|
||||
status=sasstat0
|
||||
WAIT
|
||||
@@ -2639,7 +2676,9 @@ data _null_;
|
||||
put '%include packages(loadpackage.sas);' /; /* for older versions when the SPFinit.sas did not exist */
|
||||
|
||||
put '%loadpackage'"(&packageName.,";
|
||||
put " path=&filesLocation.) " /;
|
||||
put " path=&filesLocation.)" /;
|
||||
put '%loadpackage'"(&packageName.,";
|
||||
put " path=&filesLocation., lazyData=*)" /;
|
||||
run;
|
||||
|
||||
%local t;
|
||||
@@ -2652,7 +2691,7 @@ systask command
|
||||
-print ""&dirForTest./&&TEST_&t...lst""
|
||||
-log ""&dirForTest./&&TEST_&t...log""
|
||||
-config ""&SASROOT./sasv9.cfg""
|
||||
-work ""&dirForTest./work""
|
||||
-work ""&dirForTestWork.""
|
||||
-autoexec ""&dirForTest./autoexec.sas""
|
||||
-noterminal
|
||||
-rsasuser"
|
||||
@@ -2722,6 +2761,9 @@ title;
|
||||
%put *%sysfunc(DLGCDIR(%sysfunc(pathname(currdir))))*;
|
||||
filename CURRDIR clear;
|
||||
|
||||
/* turn on the original value of the note about quoted string length */
|
||||
options "elenmax_tmp.;
|
||||
|
||||
/* if you do not want any test to be executed */
|
||||
%NOTESTING:
|
||||
|
||||
@@ -2808,7 +2850,7 @@ TODO: (in Polish)
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20201014. Run %loadPackages() for help info.'
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20201018. Run %loadPackages() for help info.'
|
||||
parmbuff
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
@@ -2824,7 +2866,7 @@ parmbuff
|
||||
%put ### This is short help information for the `loadPackageS` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20201014` #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -2908,7 +2950,7 @@ parmbuff
|
||||
hashing_file() function, SAS 9.4M6 */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20201014. Run %verifyPackage() for help info.'
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20201018. Run %verifyPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -2923,7 +2965,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20201014. Run %
|
||||
%put ### This is short help information for the `verifyPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20201014` #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20201018` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -18,7 +18,7 @@ data class;
|
||||
WH = weight + height;
|
||||
run;
|
||||
```
|
||||
SHA256 digest for SQLinDS: F070926B26504F9F65384EE3FB84E2E54B223FDAB71EDD61B11B865262C2E5DD
|
||||
SHA256 digest for SQLinDS: 135DC50C0412B8CEAF6D5349B8A203C0ADB23D4F5C2680B6A35FD2E5482B6C49
|
||||
|
||||
[Documentation for SQLinDS](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/sqlinds.md "Documentation for SQLinDS")
|
||||
|
||||
@@ -51,11 +51,11 @@ data _null_;
|
||||
end;
|
||||
run;
|
||||
```
|
||||
SHA256 digest for DFA: 7E9042867ED9C4BD2F27B3CD9180701CE619E301C13F5BD82DB46547616D17DF
|
||||
SHA256 digest for DFA: E67A0863992722A5F535F56E14EF8D19A55F74FB374447BF11B5ED74029C29CB
|
||||
|
||||
---
|
||||
|
||||
- **macroArray**\[0.5\], implementation of an array concept in a macro language, e.g.
|
||||
- **macroArray**\[0.6\], implementation of an array concept in a macro language, e.g.
|
||||
```
|
||||
%array(ABC[17] (111:127), macarray=Y);
|
||||
|
||||
@@ -74,7 +74,7 @@ SHA256 digest for DFA: 7E9042867ED9C4BD2F27B3CD9180701CE619E301C13F5BD82DB465476
|
||||
which = 1:H:2
|
||||
);
|
||||
```
|
||||
SHA256 digest for macroArray: 519B1CE64F66F8498B10F5EB253BB45FC860E3F7868FCEB97ABF45C96F30716D
|
||||
SHA256 digest for macroArray: 42771AA7CD2A0608E1EE25F104F21CCCC296919910E4BCA7AD9AE46A291BB8D7
|
||||
|
||||
[Documentation for macroArray](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/macroarray.md "Documentation for macroArray")
|
||||
|
||||
@@ -94,7 +94,7 @@ format x bool.;
|
||||
|
||||
%put %getVars(sashelp.class, pattern = ght$, sep = +, varRange = _numeric_);
|
||||
```
|
||||
SHA256 digest for BasePlus: 75B8D2BF718E035FEFC0D24504A6EBB9893883E2DF5D0FCD2D8ADD28456CFEBD
|
||||
SHA256 digest for BasePlus: BDEA8AA6EED9739284ABF8297BEC7EC0F12490D72EF9B685F477E99AFA734B82
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/master/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
@@ -102,6 +102,6 @@ SHA256 digest for BasePlus: 75B8D2BF718E035FEFC0D24504A6EBB9893883E2DF5D0FCD2D8A
|
||||
|
||||
- **dynMacroArray**\[0.2\], set of macros (wrappers for a hash table) emulating dynamic array in the data step (macro predecessor of DFA)
|
||||
|
||||
SHA256 digest for dynMacroArray: FF111DA330ACE57BAE8C9B7890839045B691A17414AE04CBD49C66BCD9663B21
|
||||
SHA256 digest for dynMacroArray: 694AACE925B7F4E149C3B90383F56370ED76233D8F5040713D66C1F3A4E414FE
|
||||
|
||||
---
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
/* 20201018 */
|
||||
BasePlus: BDEA8AA6EED9739284ABF8297BEC7EC0F12490D72EF9B685F477E99AFA734B82
|
||||
DFA: E67A0863992722A5F535F56E14EF8D19A55F74FB374447BF11B5ED74029C29CB
|
||||
dynMacroArray: 694AACE925B7F4E149C3B90383F56370ED76233D8F5040713D66C1F3A4E414FE
|
||||
macroArray: 42771AA7CD2A0608E1EE25F104F21CCCC296919910E4BCA7AD9AE46A291BB8D7
|
||||
SQLinDS: 135DC50C0412B8CEAF6D5349B8A203C0ADB23D4F5C2680B6A35FD2E5482B6C49
|
||||
|
||||
/* 20201017 */
|
||||
macroArray: 022A7CD5F0C1E72032CC3426A8AC53D61A8766868B6B48195BC69F59007323B8
|
||||
|
||||
/* 20201014 */
|
||||
BasePlus: 75B8D2BF718E035FEFC0D24504A6EBB9893883E2DF5D0FCD2D8ADD28456CFEBD
|
||||
DFA: 7E9042867ED9C4BD2F27B3CD9180701CE619E301C13F5BD82DB46547616D17DF
|
||||
dynMacroArray: FF111DA330ACE57BAE8C9B7890839045B691A17414AE04CBD49C66BCD9663B21
|
||||
macroArray: 519B1CE64F66F8498B10F5EB253BB45FC860E3F7868FCEB97ABF45C96F30716D
|
||||
SQLinDS: F070926B26504F9F65384EE3FB84E2E54B223FDAB71EDD61B11B865262C2E5DD
|
||||
BasePlus: 4E0C2A45CF8A5863C0D054568C712D10A296240877D604E77A778451A740874B
|
||||
DFA: CC19058354D4B51F0675A8414F18089CCC583AA45822CEFC79368F06D8715846
|
||||
dynMacroArray: 0854317DE7A97DCFE30411B37D909F04BBE12F1F9F7C45D39CBCD61641158F80
|
||||
macroArray: 96215AC04EF26C97719F6B1EDA5ACAF7DD491B7F2DDDE9985A0560CD2916ABA1
|
||||
SQLinDS: FCD7EE5B59E08CD1A2E31F6A5D94D7275C99AFFAACEA3D187F60A57CD0520FCD
|
||||
|
||||
/* 20201010 */
|
||||
SQLinDS: D76B85EFF129678B45233FB397A2BDB8D23F234013BD821D55141CA18DD5589E
|
||||
|
||||
@@ -1,19 +1,21 @@
|
||||
/*** HELP START ***/
|
||||
/*
|
||||
## >>> library `dsSQL`: <<< <a name="library-dssql"></a> ########################
|
||||
|
||||
/* >>> dsSQL library: <<<
|
||||
*
|
||||
* The dsSQL library stores temporary views
|
||||
* generated during the %SQL() macro execution.
|
||||
* If possible a subdirectory of WORK is created as:
|
||||
The `dsSQL` library stores temporary views
|
||||
generated during the `%SQL()` macro execution.
|
||||
|
||||
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))/dsSQLtmp";
|
||||
|
||||
* if not possible then redirects to WORK as:
|
||||
|
||||
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))";
|
||||
|
||||
**/
|
||||
If possible a subdirectory of the `WORK` location is created, like:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))/dsSQLtmp";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if not possible, then redirects to the `WORK` location, like:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
LIBNAME dsSQL BASE "%sysfunc(pathname(WORK))";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
---
|
||||
*/
|
||||
/*** HELP END ***/
|
||||
|
||||
data _null_;
|
||||
@@ -25,5 +27,5 @@ data _null_;
|
||||
rc1 = LIBNAME("dsSQL", "%sysfunc(pathname(work))", "BASE");
|
||||
run;
|
||||
|
||||
/* list details about the library in the log */
|
||||
/* list the details about the library in the log */
|
||||
libname dsSQL LIST;
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
/*** HELP START ***/
|
||||
/*
|
||||
## >>> `%dsSQL_Inner()` macro: <<< <a name="dssql-inner-macro"></a> #############
|
||||
|
||||
/* >>> %dsSQL_Inner() macro: <<<
|
||||
*
|
||||
* Internal macro called by dsSQL() function.
|
||||
* The macro generates a uniqualy named sql view on the fly
|
||||
* which is stored in DSSQL library.
|
||||
*
|
||||
* Recommended for SAS 9.3 and higher.
|
||||
* Based on paper:
|
||||
* "Use the Full Power of SAS in Your Function-Style Macros"
|
||||
* by Mike Rhoads, Westat, Rockville, MD
|
||||
* https://support.sas.com/resources/papers/proceedings12/004-2012.pdf
|
||||
*
|
||||
**/
|
||||
**Internal** macro called by `dsSQL()` function.
|
||||
The macro generates a uniquely named SQL view on the fly
|
||||
which is then stored in the `dsSQL` library.
|
||||
|
||||
Recommended for *SAS 9.3* and higher.
|
||||
|
||||
---
|
||||
*/
|
||||
/*** HELP END ***/
|
||||
|
||||
/* inner macro */
|
||||
@@ -57,7 +53,7 @@
|
||||
%put *****************;
|
||||
|
||||
proc sql;
|
||||
%include &tempfile2.; /* &query */
|
||||
%include &tempfile2.; /* the &query */
|
||||
;
|
||||
quit;
|
||||
filename &tempfile1. clear;
|
||||
|
||||
@@ -1,41 +1,47 @@
|
||||
/*** HELP START ***/
|
||||
/*
|
||||
## >>> `%SQL()` macro: <<< <a name="dssql-macro"></a> ###########################
|
||||
|
||||
/* >>> %SQL() macro: <<<
|
||||
*
|
||||
* Main macro which allows to use
|
||||
* SQL's queries in the data step.
|
||||
* Recommended for SAS 9.3 and higher.
|
||||
* Based on paper:
|
||||
* "Use the Full Power of SAS in Your Function-Style Macros"
|
||||
* by Mike Rhoads, Westat, Rockville, MD
|
||||
* https://support.sas.com/resources/papers/proceedings12/004-2012.pdf
|
||||
*
|
||||
* SYNTAX:
|
||||
The **main** macro which allows to use
|
||||
SQL queries in the data step.
|
||||
|
||||
Recommended for *SAS 9.3* and higher.
|
||||
|
||||
Based on the article *"Use the Full Power of SAS in Your Function-Style Macros"*
|
||||
by *Mike Rhoads* (Westat, Rockville), available at:
|
||||
[https://support.sas.com/resources/papers/proceedings12/004-2012.pdf](https://support.sas.com/resources/papers/proceedings12/004-2012.pdf)
|
||||
|
||||
%sql(<nonempty sql querry code>)
|
||||
### SYNTAX: ###################################################################
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%sql(<nonempty sql querry code>)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
* The sql querry code is limited to 32000 bytes.
|
||||
*
|
||||
* EXAMPLE 1: simple sql query
|
||||
The sql query code is limited to *32000* bytes.
|
||||
|
||||
data class_subset;
|
||||
set %SQL(select name, sex, height from sashelp.class where age > 12);
|
||||
run;
|
||||
### EXAMPLES: #################################################################
|
||||
|
||||
* EXAMPLE 2: query with dataset options
|
||||
**EXAMPLE 1**: simple SQL query
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data class_subset;
|
||||
set %SQL(select name, sex, height from sashelp.class where age > 12);
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
data renamed;
|
||||
set %SQL(select * from sashelp.class where sex = "F")(rename = (age=age2));
|
||||
run;
|
||||
|
||||
* EXAMPLE 3: dictionaries in datastep
|
||||
|
||||
data dictionary;
|
||||
set %SQL(select * from dictionary.macros);
|
||||
run;
|
||||
|
||||
**/
|
||||
**EXAMPLE 2**: query with dataset options
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data renamed;
|
||||
set %SQL(select * from sashelp.class where sex = "F")(rename = (age=age2));
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 3**: dictionaries in the data step
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data dictionary;
|
||||
set %SQL(select * from dictionary.macros);
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
---
|
||||
*/
|
||||
/*** HELP END ***/
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
/*** HELP START ***/
|
||||
/*
|
||||
## >>> `dsSQL()` function: <<< <a name="dssql-function"></a> ####################
|
||||
|
||||
/* >>> dsSQL() function: <<<
|
||||
*
|
||||
* Internal function called by %SQL() macro.
|
||||
* The function pass query code from the %SQL()
|
||||
* macro to the %dsSQL_Inner() innternal macreo.
|
||||
*
|
||||
* Recommended for SAS 9.3 and higher.
|
||||
* Based on paper:
|
||||
* "Use the Full Power of SAS in Your Function-Style Macros"
|
||||
* by Mike Rhoads, Westat, Rockville, MD
|
||||
* https://support.sas.com/resources/papers/proceedings12/004-2012.pdf
|
||||
*
|
||||
**/
|
||||
**Internal** function called by the `%SQL()` macro.
|
||||
The function pass a query code from the `%SQL()`
|
||||
macro to the `%dsSQL_Inner()` internal macro.
|
||||
|
||||
Recommended for *SAS 9.3* and higher.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
dsSQL(unique_index_2, query)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `unique_index_2` - *Numeric*, internal variable, a unique index for views.
|
||||
|
||||
2. `query` - *Character*, internal variable, contains query text.
|
||||
|
||||
---
|
||||
*/
|
||||
/*** HELP END ***/
|
||||
|
||||
proc fcmp
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
Type: Package :/*required, not null, constant value*/
|
||||
Package: SQLinDS :/*required, not null, up to 24 characters, naming restrictions like for a dataset name! */
|
||||
Title: SQL queries in Data Step :/*required, not null*/
|
||||
Version: 2.1 :/*required, not null*/
|
||||
Version: 2.2 :/*required, not null*/
|
||||
Author: Mike Rhoads (RhoadsM1@Westat.com) :/*required, not null*/
|
||||
Maintainer: Bartosz Jablonski (yabwon@gmail.com) :/*required, not null*/
|
||||
License: MIT :/*required, not null, values: MIT, GPL2, BSD, etc.*/
|
||||
@@ -18,28 +18,32 @@ Required: "Base SAS Software" :/*optional, COMMA separated, Q
|
||||
/* All the text below will be used in help */
|
||||
DESCRIPTION START:
|
||||
|
||||
The SQLinDS package is an implementation of
|
||||
the macro-function-sandwich concept introduced in:
|
||||
"Use the Full Power of SAS in Your Function-Style Macros"
|
||||
the article by Mike Rhoads, Westat, Rockville, MD
|
||||
# The SQLinDS package [ver. 2.2] <a name="sqlinds-package"></a> ###############################################
|
||||
|
||||
The **SQLinDS** package is an implementation of
|
||||
the *macro-function-sandwich* concept introduced in the
|
||||
*"Use the Full Power of SAS in Your Function-Style Macros"*,
|
||||
the article by *Mike Rhoads (Westat, Rockville)*.
|
||||
|
||||
Copy of the article is available at:
|
||||
https://support.sas.com/resources/papers/proceedings12/004-2012.pdf
|
||||
|
||||
Package provides ability to "execute" SQL queries inside a datastep, e.g.
|
||||
[https://support.sas.com/resources/papers/proceedings12/004-2012.pdf](https://support.sas.com/resources/papers/proceedings12/004-2012.pdf)
|
||||
|
||||
Package provides ability to *execute* SQL queries inside a data step, e.g.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data class;
|
||||
set %SQL(select * from sashelp.class);
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
See the help for the `%SQL()` macro to find more examples.
|
||||
|
||||
### Content ###################################################################
|
||||
|
||||
SQLinDS package contains the following components:
|
||||
|
||||
1) %SQL() macro - the main package macro available for the User
|
||||
|
||||
2) dsSQL() function (internal)
|
||||
3) %dsSQL_inner() macro (internal)
|
||||
4) Library DSSQL (created in a subdirectory of the WORK library)
|
||||
|
||||
See help for the %SQL() macro to find more examples.
|
||||
1. `%SQL()` macro - the main package macro available for the User
|
||||
2. `dsSQL()` function (internal)
|
||||
3. `%dsSQL_inner()` macro (internal)
|
||||
4. Library `DSSQL` (created as a subdirectory of the `WORK` library)
|
||||
|
||||
---
|
||||
DESCRIPTION END:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
resetline;
|
||||
|
||||
|
||||
filename packages "C:\SAS_PACKAGES\SASPackagesFramework";
|
||||
filename packages "C:\SAS_PACKAGES\SPF";
|
||||
%include packages(SPFinit.sas);
|
||||
|
||||
ods html;
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
|
||||
options dlCreateDir;
|
||||
libname dsSQL "%sysfunc(pathname(work))/dsSQLtmp";
|
||||
|
||||
/* makro zewnetrzne */
|
||||
%MACRO SQL() / PARMBUFF SECURE;
|
||||
%let SYSPBUFF = %superq(SYSPBUFF); /* maskujemy znaki specjalne */
|
||||
%let SYSPBUFF = %substr(&SYSPBUFF,2,%LENGTH(&SYSPBUFF) - 2); /* kasujemy otwierający i zamykający nawias */
|
||||
%let SYSPBUFF = %superq(SYSPBUFF); /* maskujemy jeszcze raz */
|
||||
%let SYSPBUFF = %sysfunc(quote(&SYSPBUFF)); /* dodajemy cudzyslowy */
|
||||
%put ***the querry***;
|
||||
%put &SYSPBUFF.;
|
||||
%put ****************;
|
||||
|
||||
%local UNIQUE_INDEX; /* dodatkowa zmienna indeksujaca, zeby tworzony widok byl unikalny */
|
||||
%let UNIQUE_INDEX = &SYSINDEX; /* przypisujemy jej wartosc */
|
||||
%sysfunc(dsSQL(&UNIQUE_INDEX, &SYSPBUFF)) /* <-- wywolulemy funkcje dsSQL */
|
||||
%MEND SQL;
|
||||
|
||||
/* funkcja */
|
||||
%macro MacroFunctionSandwich_functions();
|
||||
|
||||
%local _cmplib_;
|
||||
options APPEND=(cmplib = WORK.DATASTEPSQLFUNCTIONS) ;
|
||||
%let _cmplib_ = %sysfunc(getoption(cmplib));
|
||||
%put NOTE:[&sysmacroname.] *&=_cmplib_*;
|
||||
|
||||
options cmplib = _null_;
|
||||
|
||||
proc fcmp outlib=work.datastepSQLfunctions.package;
|
||||
function dsSQL(unique_index_2, query $) $ 41;
|
||||
|
||||
length query query_arg $ 32000 viewname $ 41; /* query_arg mozna zmienic na dluzszy, np. 32000 :-) */
|
||||
query_arg = dequote(query);
|
||||
rc = run_macro('dsSQL_Inner', unique_index_2, query_arg, viewname); /* <-- wywolulemy makro wewnetrzne dsSQL_Inner */
|
||||
if rc = 0 then return(trim(viewname));
|
||||
else do;
|
||||
return(" ");
|
||||
put 'ERROR:[function dsSQL] A problem with the function';
|
||||
end;
|
||||
endsub;
|
||||
run;
|
||||
|
||||
options cmplib = &_cmplib_.;
|
||||
%let _cmplib_ = %sysfunc(getoption(cmplib));
|
||||
%put NOTE:[&sysmacroname.] *&=_cmplib_*;
|
||||
|
||||
%mend MacroFunctionSandwich_functions;
|
||||
%MacroFunctionSandwich_functions()
|
||||
|
||||
/* delete macro MacroFunctionSandwich_functions since it is not needed */
|
||||
proc sql;
|
||||
create table _%sysfunc(datetime(), hex16.)_ as
|
||||
select memname, objname
|
||||
from dictionary.catalogs
|
||||
where
|
||||
objname = upcase('MACROFUNCTIONSANDWICH_FUNCTIONS')
|
||||
and objtype = 'MACRO'
|
||||
and libname = 'WORK'
|
||||
order by memname, objname
|
||||
;
|
||||
quit;
|
||||
data _null_;
|
||||
set _last_;
|
||||
call execute('proc catalog cat = work.' !! strip(memname) !! ' et = macro force;');
|
||||
call execute('delete ' !! strip(objname) !! '; run;');
|
||||
call execute('quit;');
|
||||
run;
|
||||
proc delete data = _last_;
|
||||
run;
|
||||
|
||||
/* makro wewnetrzne */
|
||||
%MACRO dsSQL_Inner() / SECURE;
|
||||
%local query;
|
||||
%let query = %superq(query_arg);
|
||||
%let query = %sysfunc(dequote(&query));
|
||||
|
||||
%let viewname = dsSQL.dsSQLtmpview&UNIQUE_INDEX_2;
|
||||
proc sql;
|
||||
create view &viewname as &query;
|
||||
quit;
|
||||
%MEND dsSQL_Inner;
|
||||
@@ -186,7 +186,7 @@ Package contains:
|
||||
*SAS package generated by generatePackage, version 20201001*
|
||||
|
||||
The SHA256 hash digest for package BasePlus:
|
||||
`75B8D2BF718E035FEFC0D24504A6EBB9893883E2DF5D0FCD2D8ADD28456CFEBD`
|
||||
`BDEA8AA6EED9739284ABF8297BEC7EC0F12490D72EF9B685F477E99AFA734B82`
|
||||
|
||||
---
|
||||
# Content description ############################################################################################
|
||||
|
||||
Binary file not shown.
BIN
packages/dfa.zip
BIN
packages/dfa.zip
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,7 @@
|
||||
|
||||
---
|
||||
|
||||
# The macroArray package [ver. 0.5] <a name="macroarray-package"></a> ###############################################
|
||||
# The macroArray package [ver. 0.6] <a name="macroarray-package"></a> ###############################################
|
||||
|
||||
The **macroArray** package implements a macro array facility:
|
||||
- `%array()`,
|
||||
@@ -63,7 +63,7 @@ Required SAS Components:
|
||||
*SAS package generated by generatePackage, version 20200911*
|
||||
|
||||
The SHA256 hash digest for package macroArray:
|
||||
`519B1CE64F66F8498B10F5EB253BB45FC860E3F7868FCEB97ABF45C96F30716D`
|
||||
`42771AA7CD2A0608E1EE25F104F21CCCC296919910E4BCA7AD9AE46A291BB8D7`
|
||||
|
||||
---
|
||||
# Content description ############################################################################################
|
||||
@@ -306,7 +306,12 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
or when used with second parameter equal `I` (insert) allow to overwrite macroarrays
|
||||
value:
|
||||
`%let %myArr(17,i) = 42;`
|
||||
|
||||
If set to `M` then for a given array name the macro symbols table is scanned for
|
||||
macrovariables with prefix like the array name and numeric suffixes,
|
||||
then the minimum and the maximum index is determined
|
||||
and all not existing global macrovariables are created and
|
||||
a macro is generated in the same way as for the `Y` value
|
||||
|
||||
* `ds=` - *Optional*, use a dataset as a basis for a macroarray data,
|
||||
if used by default overwrites use of the `array` parameter, honors `macarray=`
|
||||
argument, dataset options are allowed, e.g. `sashelp.class(obs=5)`
|
||||
@@ -570,6 +575,19 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
%array(ds = sashelp.cars(obs=100 where=(Cylinders=6)), vars = Make| Type| Model, macarray=Y)
|
||||
%put *%make(&makeLBOUND.)*%Model(2)*%Model(3)*%Model(4)*%type(&typeHBOUND.)*;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 13.** Creating an array and macro from existing list of macrovariables
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%let myTest3 = 13;
|
||||
%let myTest6 = 16;
|
||||
%let myTest9 = 19;
|
||||
|
||||
%array(myTest, macarray=M)
|
||||
%do_over(myTest, phrase = %nrstr(%put *&_I_.*%myTest(&_I_.)*;))
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1088,7 +1106,7 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Create a "4-loop" `%DO_OVER4()` macro
|
||||
**EXAMPLE 2.** Create a "4-loop" `%DO_OVER4()` macro
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%make_do_over(4);
|
||||
|
||||
Binary file not shown.
@@ -49,7 +49,7 @@ Required SAS Components:
|
||||
*SAS package generated by generatePackage, version 20200911*
|
||||
|
||||
The SHA256 hash digest for package SQLinDS:
|
||||
`F070926B26504F9F65384EE3FB84E2E54B223FDAB71EDD61B11B865262C2E5DD`
|
||||
`135DC50C0412B8CEAF6D5349B8A203C0ADB23D4F5C2680B6A35FD2E5482B6C49`
|
||||
|
||||
---
|
||||
# Content description ############################################################################################
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user