mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2026-06-15 22:40:21 +00:00
75a8b77406
SAS Packages Framework, version `20260615` Changes: - Documentation update. Answer to issue: https://github.com/yabwon/SAS_PACKAGES/issues/136
231 lines
11 KiB
SAS
231 lines
11 KiB
SAS
/*+headerPackage+*/
|
|
/**############################################################################**/
|
|
/* */
|
|
/* Copyright Bartosz Jablonski, since July 2019 onward. */
|
|
/* */
|
|
/* Code is free and open source. If you want - you can use it. */
|
|
/* I tested it the best I could */
|
|
/* but it comes with absolutely no warranty whatsoever. */
|
|
/* If you cause any damage or something - it will be your own fault. */
|
|
/* You have been warned! You are using it on your own risk. */
|
|
/* However, if you decide to use it do not forget to mention author: */
|
|
/* Bartosz Jablonski (yabwon@gmail.com) */
|
|
/* */
|
|
/* Here is the official version: */
|
|
/*
|
|
Copyright (c) 2019 - 2026 Bartosz Jablonski (yabwon@gmail.com)
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
The above copyright notice and this permission notice shall be included
|
|
in all copies or substantial portions of the Software.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
*/
|
|
/**#############################################################################**/
|
|
|
|
/*** HELP START ***/
|
|
/* SPF (SAS Packages Framework) is a set of macros:
|
|
- to install,
|
|
- to load,
|
|
- to get help,
|
|
- to unload, or
|
|
- to generate SAS packages.
|
|
|
|
SAS Packages Framework, version 20260615.
|
|
See examples below.
|
|
|
|
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
|
|
a single load.sas file (also embedded inside the zip).
|
|
|
|
Contributors:
|
|
- Stu Sztukowski
|
|
LinkedIn: https://www.linkedin.com/in/statsguy/
|
|
GitHub: https://github.com/stu-code
|
|
- Ken Nakamatsu
|
|
LinkedIn: https://www.linkedin.com/in/k-nkmt
|
|
GitHub: https://github.com/k-nkmt
|
|
|
|
*/
|
|
/*** HELP END ***/
|
|
|
|
/*+SasPackagesFrameworkNotes+*/
|
|
%macro SasPackagesFrameworkNotes(
|
|
SPFmacroName /* space separated list of names */
|
|
)
|
|
/
|
|
minoperator
|
|
secure
|
|
des = 'Macro to provide help notes about SAS Packages Framework macros, version 20260615. Run %SasPackagesFrameworkNotes(HELP) for help info.'
|
|
;
|
|
%local list N i element;
|
|
%let list=
|
|
installPackage
|
|
listPackages
|
|
/**/
|
|
verifyPackage
|
|
previewPackage
|
|
helpPackage
|
|
/**/
|
|
loadPackage
|
|
loadPackageS
|
|
loadPackageAddCnt
|
|
/**/
|
|
unloadPackage
|
|
/**/
|
|
generatePackage
|
|
splitCodeForPackage
|
|
/**/
|
|
extendPackagesFileref
|
|
relocatePackage
|
|
isPackagesFilerefOK
|
|
bundlePackages
|
|
unbundlePackages
|
|
/**/
|
|
SasPackagesFrameworkNotes
|
|
;
|
|
%let N = %sysfunc(countw(&list.));
|
|
|
|
%let SPFmacroName = %sysfunc(compress(%superq(SPFmacroName),_ *,KAD));
|
|
|
|
%if (%qupcase(&SPFmacroName.) = HELP) %then
|
|
%do;
|
|
%local options_tmp ;
|
|
%let options_tmp = ls=%sysfunc(getoption(ls)) ps=%sysfunc(getoption(ps))
|
|
%sysfunc(getoption(notes)) %sysfunc(getoption(source))
|
|
msglevel=%sysfunc(getoption(msglevel))
|
|
%sysfunc(getoption(mprint)) %sysfunc(getoption(mlogic)) %sysfunc(getoption(symbolgen))
|
|
;
|
|
options NOnotes NOsource ls=MAX ps=MAX msglevel=N NOmprint NOmlogic NOsymbolgen;
|
|
%put ;
|
|
%put #################################################################################;
|
|
%put ### This is short help information for the `SasPackagesFrameworkNotes` macro #;
|
|
%put #-------------------------------------------------------------------------------#;
|
|
%put # #;
|
|
%put # Macro prints help notes for SAS Packages Framework macros, version `20260615` #;
|
|
%put # #;
|
|
%put # A SAS package is a zip file containing a group #;
|
|
%put # of SAS codes (macros, functions, data steps generating #;
|
|
%put # data, etc.) wrapped up together and included by #;
|
|
%put # a single `load.sas` file (also embedded inside the zip). #;
|
|
%put # #;
|
|
%put # The `%nrstr(%%SasPackagesFrameworkNotes())` macro provides help notes about #;
|
|
%put # components of the SAS Packages Framework. #;
|
|
%put # #;
|
|
%put #-------------------------------------------------------------------------------#;
|
|
%put #### Parameters: #;
|
|
%put # #;
|
|
%put # 1. `SPFmacroName` *Required.* Names of a SPF components. #;
|
|
%put # Names should be space separated, asterisk(*) is #;
|
|
%put # allowed too. In such case ALL help notes are printed #;
|
|
%put # If equal `HELP` displays this help information. #;
|
|
%put # If empty displays list of SPF macros. #;
|
|
%put # #;
|
|
%put #-------------------------------------------------------------------------------#;
|
|
%put # #;
|
|
%put # Visit: `https://github.com/yabwon/SAS_PACKAGES/tree/main/SPF/Documentation` #;
|
|
%put # to learn more. #;
|
|
%put # Tutorials available at: `https://github.com/yabwon/HoW-SASPackages` #;
|
|
%put # #;
|
|
%put ### Example 1 ###################################################################;
|
|
%put # #;
|
|
%put # Run the following code to print all SPF help notes: #;
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
|
%put %nrstr( %%SasPackagesFrameworkNotes(*) %%* print ALL notes; );
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
|
%put # #;
|
|
%put ### Example 2 ###################################################################;
|
|
%put # #;
|
|
%put # Run the following code to list all SPF macros: #;
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
|
%put %nrstr( %%SasPackagesFrameworkNotes() %%* list all macro names; );
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
|
%put # #;
|
|
%put ### Example 3 ###################################################################;
|
|
%put # #;
|
|
%put # Run the following code to print help notes: #;
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas;
|
|
%put %nrstr( %%SasPackagesFrameworkNotes(generatePackage helpPackage) );
|
|
%put ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
|
|
%put # #;
|
|
%put #################################################################################;
|
|
%put ;
|
|
options &options_tmp.;
|
|
%GOTO ENDofSPFNotes;
|
|
%end;
|
|
|
|
%if %sysevalf(%superq(SPFmacroName)=,boolean) %then
|
|
%do;
|
|
%put ================================================================;
|
|
%put %str( ) SAS Packages Framework provides the following macros:;
|
|
%put ================================================================;
|
|
%do i = 1 %to &N.;
|
|
%let element = %scan(&list., &i.);
|
|
%if &i. IN (3 6 9 10 12) %then %put %str( );
|
|
%if &i. > 9 %then %put %str( )&i.. %NRSTR(%%)&element.();
|
|
%else %put %str( )&i.. %NRSTR(%%)&element.();
|
|
%end;
|
|
%put =================================================================;
|
|
%end;
|
|
%else %if %str(*) IN (%superq(SPFmacroName)) %then
|
|
%do;
|
|
%do i = 1 %to &N.;
|
|
%let element = %scan(&list., &i.);
|
|
%put %str( );
|
|
%put ======;
|
|
%&element.(HELP)
|
|
%put ======;
|
|
%end;
|
|
%end;
|
|
%else
|
|
%do;
|
|
%let N = %sysfunc(countw(%superq(SPFmacroName)));
|
|
%do i = 1 %to &N.;
|
|
%let element = %qupcase(%scan(%superq(SPFmacroName), &i.));
|
|
%if %superq(element) in (%upcase(&LIST.)) %then
|
|
%do;
|
|
%let element = %unquote(&element.);
|
|
%put %str( );
|
|
%put ======;
|
|
%&element.(HELP);
|
|
%put ======;
|
|
%end;
|
|
%else
|
|
%do;
|
|
%put %str( );
|
|
%put ***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***;
|
|
%put WARNING: Cannot recognise name: %superq(element).;
|
|
%put WARNING- Valid values are: %superq(list);
|
|
%put ***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***!***;
|
|
%end;
|
|
%end;
|
|
%end;
|
|
|
|
%ENDofSPFNotes:
|
|
%mend SasPackagesFrameworkNotes;
|
|
|
|
/*
|
|
%SasPackagesFrameworkNotes()
|
|
%SasPackagesFrameworkNotes(HELP)
|
|
options mlogic symbolgen;
|
|
%SasPackagesFrameworkNotes(generatePackage)
|
|
%SasPackagesFrameworkNotes(generatePackage helpPackage)
|
|
%SasPackagesFrameworkNotes(generatePackage helpPackages SasPackagesFrameworkNotes isPackagesFilerefOK)
|
|
%SasPackagesFrameworkNotes(*)
|
|
*/
|
|
|
|
|