mirror of
https://github.com/yabwon/SAS_PACKAGES.git
synced 2025-12-11 11:14:35 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e55275d308 | ||
|
|
72a77edb16 | ||
|
|
dbe8dbc938 | ||
|
|
9168f4b4f0 |
@@ -14,7 +14,7 @@ In this repository we are presenting the **SAS Packages Framework** which allows
|
||||
|
||||
### Current version:
|
||||
|
||||
**The latest version** of SPF is **`20230411`**.
|
||||
**The latest version** of SPF is **`20230520`**.
|
||||
|
||||
To get started with SAS Packages try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
|
||||
|
||||
@@ -224,7 +224,7 @@ SHA256 digest for macroArray: F*85E3BE4D163AC5223B6EC9D3C25C46564A656E3830998B45
|
||||
|
||||
[MacroArray in SASPAC](https://github.com/SASPAC/macroarray "MacroArray in SASPAC")
|
||||
|
||||
- **BasePlus**\[1.19.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
- **BasePlus**\[1.24.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
```sas
|
||||
call arrMissToRight(myArray);
|
||||
call arrFillMiss(17, myArray);
|
||||
@@ -245,8 +245,10 @@ format x bool.;
|
||||
%bpPIPE(ls -la ~/)
|
||||
|
||||
%dirsAndFiles(C:\SAS_WORK\,ODS=work.result)
|
||||
|
||||
%put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$);
|
||||
```
|
||||
SHA256 digest for BasePlus: F*B5BF05531BF78DCEBC436BD93311FED0436D83AA3D106ABFBAD96B04C7D63DF2
|
||||
SHA256 digest for BasePlus: F*0CCAA009D64CC20ED315FA123C233E0383967E635EB8708E7A48EEE3767C6BC5
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
when empty the "packages" value is used */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20230411. Run %extendPackagesFileref(HELP) for help info.'
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20230520. Run %extendPackagesFileref(HELP) for help info.'
|
||||
;
|
||||
|
||||
%if %QUPCASE(&packages.) = HELP %then
|
||||
@@ -22,7 +22,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20230411
|
||||
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20230411` #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
default value 1 means "delete tests work" */
|
||||
)/ secure minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to generate SAS packages, version 20230411. Run %generatePackage() for help info.'
|
||||
des = 'Macro to generate SAS packages, version 20230520. Run %generatePackage() for help info.'
|
||||
;
|
||||
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
|
||||
%do;
|
||||
@@ -38,7 +38,7 @@ des = 'Macro to generate SAS packages, version 20230411. Run %generatePackage()
|
||||
%put ### This is short help information for the `generatePackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to generate SAS packages, version `20230411` #;
|
||||
%put # Macro to generate SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -724,7 +724,7 @@ run;
|
||||
run;
|
||||
|
||||
data &filesWithCodes.addCnt;
|
||||
length root dname $ 2048 filename $ 256 dir level 8;
|
||||
length root dname $ 8192 filename $ 256 dir level 8;
|
||||
root = "&filesLocation./&additionalContent.";
|
||||
retain filename dname ' ' level 0 dir 1;
|
||||
label
|
||||
@@ -1478,7 +1478,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.;''' /
|
||||
' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"' /
|
||||
' !! '' %put with the SAS Packages Framework version 20230411.;''' /
|
||||
' !! '' %put with the SAS Packages Framework version 20230520.;''' /
|
||||
' !! '' %put ****************************************************************************;''' /
|
||||
' !! '' %GOTO theEndOfTheMacro;''' /
|
||||
' !! '' %end;''' ;
|
||||
@@ -1651,7 +1651,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.; '' !!' /
|
||||
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !!' /
|
||||
''' %put with the SAS Packages Framework version 20230411.; '' !! ' /
|
||||
''' %put with the SAS Packages Framework version 20230520.; '' !! ' /
|
||||
''' %put ****************************************************************************; '' !! ' /
|
||||
''' %GOTO theEndOfTheMacro; '' !! ' /
|
||||
''' %end; '' !! ' /
|
||||
@@ -2267,7 +2267,7 @@ data _null_;
|
||||
put "put @3 'localization (only if additional content was deployed during the installation process).';" / "put ;";
|
||||
%end;
|
||||
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20230411 *"; put "***";';
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20230520 *"; put "***";';
|
||||
|
||||
put 'run; ' /;
|
||||
|
||||
@@ -2491,20 +2491,25 @@ filename _SPFOUT_ clear;
|
||||
set &filesWithCodes.addCnt;
|
||||
if dir=0;
|
||||
|
||||
|
||||
rc1=filename("_SPFIN_" , catx('/',root,dname,filename), "disk", "lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
rc2=filename("_SPFOUT_", "%sysfunc(pathname(work,L))/addcnt.zip", "ZIP"
|
||||
,"lrecl=1 recfm=n member='" !! catx('/',dname,filename) !! "'");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
do _N_ = 1 to 10;
|
||||
rc3=fcopy("_SPFIN_","_SPFOUT_");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
if fexist("_SPFOUT_") then leave;
|
||||
else sleeprc=sleep(0.25,1);
|
||||
end;
|
||||
|
||||
rc4=fexist("_SPFOUT_");
|
||||
length rc4txt $ 8192;
|
||||
rc4txt=sysmsg();
|
||||
|
||||
if rc4 = 0 then
|
||||
@@ -2525,18 +2530,22 @@ filename _SPFOUT_ clear;
|
||||
%put Status of inserting "addcnt.zip" into the package file:;
|
||||
data _null_;
|
||||
rc1=filename("_SPFIN_" , "%sysfunc(pathname(work,L))/addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
rc2=filename("_SPFOUT_", pathname("&zipReferrence.","F"), "ZIP", "lrecl=1 recfm=n member='addcnt.zip'");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
do _N_ = 1 to 10;
|
||||
rc3=fcopy("_SPFIN_","_SPFOUT_");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
if fexist("_SPFOUT_") then leave;
|
||||
else sleeprc=sleep(0.25,1);
|
||||
end;
|
||||
|
||||
rc4=fexist("_SPFOUT_");
|
||||
length rc4txt $ 8192;
|
||||
rc4txt=sysmsg();
|
||||
|
||||
if rc4 then
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to get help about SAS package, version 20230411. Run %helpPackage() for help info.'
|
||||
des = 'Macro to get help about SAS package, version 20230520. Run %helpPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -39,7 +39,7 @@ des = 'Macro to get help about SAS package, version 20230411. Run %helpPackage()
|
||||
%put ### This is short help information for the `helpPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get help about SAS packages, version `20230411` #;
|
||||
%put # Macro to get help about SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -169,7 +169,7 @@ TODO:
|
||||
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
|
||||
*/
|
||||
|
||||
/* Macros to install SAS packages, version 20230411 */
|
||||
/* Macros to install SAS packages, version 20230520 */
|
||||
/* 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
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
/secure
|
||||
minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to install SAS package, version 20230411. Run %%installPackage() for help info.'
|
||||
des = 'Macro to install SAS package, version 20230520. Run %%installPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
%do;
|
||||
@@ -31,7 +31,7 @@ des = 'Macro to install SAS package, version 20230411. Run %%installPackage() fo
|
||||
%put ### This is short help information for the `installPackage` macro #;
|
||||
%put #--------------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to install SAS packages, version `20230411` #;
|
||||
%put # Macro to install SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -483,7 +483,7 @@ des = 'Macro to install SAS package, version 20230411. Run %%installPackage() fo
|
||||
|
||||
/* Macro to list SAS packages in packages folder.
|
||||
|
||||
Version 20230411
|
||||
Version 20230520
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*+listPackages+*/
|
||||
|
||||
%macro listPackages()/secure PARMBUFF
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20230411.'
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20230520.'
|
||||
;
|
||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
||||
%do;
|
||||
@@ -16,7 +16,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 `20230411` #;
|
||||
%put # Macro to list available SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -166,7 +166,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
|
||||
/* Macro to generate SAS packages.
|
||||
|
||||
Version 20230411
|
||||
Version 20230520
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
default is 0 - means No, 1 means Yes */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load SAS package, version 20230411. Run %loadPackage() for help info.'
|
||||
des = 'Macro to load SAS package, version 20230520. Run %loadPackage() for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -49,7 +49,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* SAS packages, version `20230411` #;
|
||||
%put # Macro to *load* SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
is provided in required version */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load additional content for a SAS package, version 20230411. Run %loadPackageAddCnt() for help info.'
|
||||
des = 'Macro to load additional content for a SAS package, version 20230520. Run %loadPackageAddCnt() for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -35,7 +35,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackageAddCnt` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20230411` #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -220,14 +220,17 @@ minoperator
|
||||
call symputx("AdditionalContent", 0, "L");
|
||||
|
||||
rc1=filename("in", pathname("&_PackageFileref_."), "ZIP", "lrecl=1 recfm=n member='addcnt.zip'");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
|
||||
if fexist("in") then
|
||||
do;
|
||||
rc2=filename("out", pathname("WORK")!!"/%lowcase(&packageName.)addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
rc3=fcopy("in","out");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
|
||||
if rc3 then put _N_ @12 (rc:) (=);
|
||||
@@ -264,6 +267,7 @@ minoperator
|
||||
end;
|
||||
if did then
|
||||
do i=1 to dnum(did);
|
||||
length file $ 8192;
|
||||
file = dread(did, i);
|
||||
output;
|
||||
keep file;
|
||||
@@ -275,6 +279,7 @@ minoperator
|
||||
set WORK.__&_TargetFileref_._zip___ end = EOF;
|
||||
wc = countw(file,"/\");
|
||||
|
||||
length libText pathname_f $ 8192;
|
||||
libText = pathname("outData", "L");
|
||||
|
||||
if scan(file, wc , "/\") = "" then
|
||||
@@ -290,12 +295,17 @@ minoperator
|
||||
rc = libname("test", libText);
|
||||
rc = libname("test");
|
||||
end;
|
||||
rc1 = filename("in", pathname("f"), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
|
||||
|
||||
pathname_f = pathname("f");
|
||||
rc1 = filename("in", strip(pathname_f), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1msg = sysmsg();
|
||||
rc2 = filename("out", catx("/", libText, scan(file, j , "/\")), "disk", "lrecl=1 recfm=n");
|
||||
length rc2txt $ 8192;
|
||||
rc2msg = sysmsg();
|
||||
|
||||
rc3 = fcopy("in", "out");
|
||||
length rc3txt $ 8192;
|
||||
rc3msg = sysmsg();
|
||||
|
||||
loadingProblem + (rc3 & 1);
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20230411. Run %loadPackages() for help info.'
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20230520. Run %loadPackages() for help info.'
|
||||
parmbuff
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
@@ -27,7 +27,7 @@ parmbuff
|
||||
%put ### This is short help information for the `loadPackageS` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20230411` #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to preview content of a SAS package, version 20230411. Run %previewPackage() for help info.'
|
||||
des = 'Macro to preview content of a SAS package, version 20230520. Run %previewPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -38,7 +38,7 @@ des = 'Macro to preview content of a SAS package, version 20230411. Run %preview
|
||||
%put ### This is short help information for the `previewPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get previwe of a SAS packages, version `20230411` #;
|
||||
%put # Macro to get previwe of a SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to unload SAS package, version 20230411. Run %unloadPackage() for help info.'
|
||||
des = 'Macro to unload SAS package, version 20230520. Run %unloadPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -35,7 +35,7 @@ des = 'Macro to unload SAS package, version 20230411. Run %unloadPackage() for h
|
||||
%put ### This is short help information for the `unloadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to unload SAS packages, version `20230411` #;
|
||||
%put # Macro to unload SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
hashing_file() function, SAS 9.4M6 */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20230411. Run %verifyPackage() for help info.'
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20230520. Run %verifyPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -28,7 +28,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20230411. Run %
|
||||
%put ### This is short help information for the `verifyPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20230411` #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
|
||||
@@ -22,7 +22,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 **`20230411`**.
|
||||
In this repository we are presenting the **SAS Packages Framework** which allows to develop and use SAS packages. The latest version of SPF is **`20230520`**.
|
||||
|
||||
**To get started with SAS Packages** try this [**`Getting Started with SAS Packages`**](https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/Getting_Started_with_SAS_Packages.pdf "Getting Started with SAS Packages") presentation (see the `./SPF/Documentation` directory).
|
||||
|
||||
@@ -40,7 +40,7 @@ After assigning the directory do not change them when using the SPF since it may
|
||||
## This is short help information for the `installPackage` macro <a name="installpackage"></a>
|
||||
--------------------------------------------------------------------------------------------
|
||||
|
||||
Macro to install SAS packages, version `20230411`
|
||||
Macro to install SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -149,7 +149,7 @@ filename packages "C:/SAS_PACKAGES";
|
||||
## This is short help information for the `helpPackage` macro <a name="helppackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to get help about SAS packages, version `20230411`
|
||||
Macro to get help about SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -220,7 +220,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
## This is short help information for the `loadPackage` macro <a name="loadpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to *load* SAS packages, version `20230411`
|
||||
Macro to *load* SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -368,7 +368,7 @@ If created, those macros are automatically deleted when the `%unloadPackage()` m
|
||||
## This is short help information for the `loadPackageS` macro <a name="loadpackages"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro wrapper for the loadPackage macro, version `20230411`
|
||||
Macro wrapper for the loadPackage macro, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -417,7 +417,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
## This is short help information for the `unloadPackage` macro <a name="unloadpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to unload SAS packages, version `20230411`
|
||||
Macro to unload SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -482,7 +482,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
## This is short help information for the `listPackages` macro <a name="listpackages"></a>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to list available SAS packages, version `20230411`
|
||||
Macro to list available SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -523,7 +523,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
## This is short help information for the `verifyPackage` macro <a name="verifypackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to verify SAS package with it hash digest, version `20230411`
|
||||
Macro to verify SAS package with it hash digest, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -577,7 +577,7 @@ filename packages "C:/SAS_PACKAGES"; %* set-up a directory for packages;
|
||||
## This is short help information for the `previewPackage` macro <a name="previewpackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to get previwe of a SAS packages, version `20230411`
|
||||
Macro to get previwe of a SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -644,7 +644,7 @@ filename packages "C:/SAS_PACKAGES"; %* setup a directory for packages;
|
||||
## This is short help information for the `generatePackage` macro <a name="generatepackage"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to generate SAS packages, version `20230411`
|
||||
Macro to generate SAS packages, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -837,7 +837,7 @@ All files have to have `.sas` extension. Other files are ignored.
|
||||
## This is short help information for the `extendPackagesFileref` macro <a name="extendpackagesfileref"></a>
|
||||
-----------------------------------------------------------------------------------------
|
||||
|
||||
Macro to list directories pointed by 'packages' fileref, version `20230411`
|
||||
Macro to list directories pointed by 'packages' fileref, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -877,7 +877,7 @@ filename packages ("D:/NEW_DIR" %extendPackagesFileref()); %* add new directory;
|
||||
## This is short help information for the `loadPackageAddCnt` macro <a name="loadpackageaddcnt"></a>
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
Macro to load *additional content* for a SAS package, version `20230411`
|
||||
Macro to load *additional content* for a SAS package, version `20230520`
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
- to unload, or
|
||||
- to generate SAS packages.
|
||||
|
||||
Version 20230411.
|
||||
Version 20230520.
|
||||
See examples below.
|
||||
|
||||
A SAS package is a zip file containing a group of files
|
||||
@@ -88,7 +88,7 @@
|
||||
default is 0 - means No, 1 means Yes */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load SAS package, version 20230411. Run %loadPackage() for help info.'
|
||||
des = 'Macro to load SAS package, version 20230520. Run %loadPackage() for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -104,7 +104,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* SAS packages, version `20230411` #;
|
||||
%put # Macro to *load* SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -350,7 +350,7 @@ minoperator
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to unload SAS package, version 20230411. Run %unloadPackage() for help info.'
|
||||
des = 'Macro to unload SAS package, version 20230520. Run %unloadPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -365,7 +365,7 @@ des = 'Macro to unload SAS package, version 20230411. Run %unloadPackage() for h
|
||||
%put ### This is short help information for the `unloadPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to unload SAS packages, version `20230411` #;
|
||||
%put # Macro to unload SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -510,7 +510,7 @@ des = 'Macro to unload SAS package, version 20230411. Run %unloadPackage() for h
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to get help about SAS package, version 20230411. Run %helpPackage() for help info.'
|
||||
des = 'Macro to get help about SAS package, version 20230520. Run %helpPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -525,7 +525,7 @@ des = 'Macro to get help about SAS package, version 20230411. Run %helpPackage()
|
||||
%put ### This is short help information for the `helpPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get help about SAS packages, version `20230411` #;
|
||||
%put # Macro to get help about SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -655,7 +655,7 @@ TODO:
|
||||
- add MD5(&packageName.) value hash instead "package" word in filenames [DONE]
|
||||
*/
|
||||
|
||||
/* Macros to install SAS packages, version 20230411 */
|
||||
/* Macros to install SAS packages, version 20230520 */
|
||||
/* 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
|
||||
@@ -680,7 +680,7 @@ TODO:
|
||||
/secure
|
||||
minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to install SAS package, version 20230411. Run %%installPackage() for help info.'
|
||||
des = 'Macro to install SAS package, version 20230520. Run %%installPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
%do;
|
||||
@@ -695,7 +695,7 @@ des = 'Macro to install SAS package, version 20230411. Run %%installPackage() fo
|
||||
%put ### This is short help information for the `installPackage` macro #;
|
||||
%put #--------------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to install SAS packages, version `20230411` #;
|
||||
%put # Macro to install SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -1147,7 +1147,7 @@ des = 'Macro to install SAS package, version 20230411. Run %%installPackage() fo
|
||||
|
||||
/* Macro to list SAS packages in packages folder.
|
||||
|
||||
Version 20230411
|
||||
Version 20230520
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1168,7 +1168,7 @@ des = 'Macro to install SAS package, version 20230411. Run %%installPackage() fo
|
||||
/*+listPackages+*/
|
||||
|
||||
%macro listPackages()/secure PARMBUFF
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20230411.'
|
||||
des = 'Macro to list SAS packages from `packages` fileref, type %listPackages(HELP) for help, version 20230520.'
|
||||
;
|
||||
%if %QUPCASE(&SYSPBUFF.) = %str(%(HELP%)) %then
|
||||
%do;
|
||||
@@ -1183,7 +1183,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 `20230411` #;
|
||||
%put # Macro to list available SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -1333,7 +1333,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
|
||||
/* Macro to generate SAS packages.
|
||||
|
||||
Version 20230411
|
||||
Version 20230520
|
||||
|
||||
A SAS package is a zip file containing a group
|
||||
of SAS codes (macros, functions, data steps generating
|
||||
@@ -1370,7 +1370,7 @@ options ls = &ls_tmp. ps = &ps_tmp. ¬es_tmp. &source_tmp.;
|
||||
default value 1 means "delete tests work" */
|
||||
)/ secure minoperator
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to generate SAS packages, version 20230411. Run %generatePackage() for help info.'
|
||||
des = 'Macro to generate SAS packages, version 20230520. Run %generatePackage() for help info.'
|
||||
;
|
||||
%if (%superq(filesLocation) = ) OR (%qupcase(&filesLocation.) = HELP) %then
|
||||
%do;
|
||||
@@ -1385,7 +1385,7 @@ des = 'Macro to generate SAS packages, version 20230411. Run %generatePackage()
|
||||
%put ### This is short help information for the `generatePackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to generate SAS packages, version `20230411` #;
|
||||
%put # Macro to generate SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -2071,7 +2071,7 @@ run;
|
||||
run;
|
||||
|
||||
data &filesWithCodes.addCnt;
|
||||
length root dname $ 2048 filename $ 256 dir level 8;
|
||||
length root dname $ 8192 filename $ 256 dir level 8;
|
||||
root = "&filesLocation./&additionalContent.";
|
||||
retain filename dname ' ' level 0 dir 1;
|
||||
label
|
||||
@@ -2825,7 +2825,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.;''' /
|
||||
' !! '' %put The macro generated: '' !! put(dtCASLudf, E8601DT19.-L) !! ";"' /
|
||||
' !! '' %put with the SAS Packages Framework version 20230411.;''' /
|
||||
' !! '' %put with the SAS Packages Framework version 20230520.;''' /
|
||||
' !! '' %put ****************************************************************************;''' /
|
||||
' !! '' %GOTO theEndOfTheMacro;''' /
|
||||
' !! '' %end;''' ;
|
||||
@@ -2998,7 +2998,7 @@ data _null_;
|
||||
%end;
|
||||
put +(-1) '`.; '' !!' /
|
||||
''' %put The macro generated: ''' " !! put(dtIML, E8601DT19.-L) !! " '''; '' !!' /
|
||||
''' %put with the SAS Packages Framework version 20230411.; '' !! ' /
|
||||
''' %put with the SAS Packages Framework version 20230520.; '' !! ' /
|
||||
''' %put ****************************************************************************; '' !! ' /
|
||||
''' %GOTO theEndOfTheMacro; '' !! ' /
|
||||
''' %end; '' !! ' /
|
||||
@@ -3614,7 +3614,7 @@ data _null_;
|
||||
put "put @3 'localization (only if additional content was deployed during the installation process).';" / "put ;";
|
||||
%end;
|
||||
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20230411 *"; put "***";';
|
||||
put 'put "***"; put "* SAS package generated by generatePackage, version 20230520 *"; put "***";';
|
||||
|
||||
put 'run; ' /;
|
||||
|
||||
@@ -3838,20 +3838,25 @@ filename _SPFOUT_ clear;
|
||||
set &filesWithCodes.addCnt;
|
||||
if dir=0;
|
||||
|
||||
|
||||
rc1=filename("_SPFIN_" , catx('/',root,dname,filename), "disk", "lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
rc2=filename("_SPFOUT_", "%sysfunc(pathname(work,L))/addcnt.zip", "ZIP"
|
||||
,"lrecl=1 recfm=n member='" !! catx('/',dname,filename) !! "'");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
do _N_ = 1 to 10;
|
||||
rc3=fcopy("_SPFIN_","_SPFOUT_");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
if fexist("_SPFOUT_") then leave;
|
||||
else sleeprc=sleep(0.25,1);
|
||||
end;
|
||||
|
||||
rc4=fexist("_SPFOUT_");
|
||||
length rc4txt $ 8192;
|
||||
rc4txt=sysmsg();
|
||||
|
||||
if rc4 = 0 then
|
||||
@@ -3872,18 +3877,22 @@ filename _SPFOUT_ clear;
|
||||
%put Status of inserting "addcnt.zip" into the package file:;
|
||||
data _null_;
|
||||
rc1=filename("_SPFIN_" , "%sysfunc(pathname(work,L))/addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
rc2=filename("_SPFOUT_", pathname("&zipReferrence.","F"), "ZIP", "lrecl=1 recfm=n member='addcnt.zip'");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
do _N_ = 1 to 10;
|
||||
rc3=fcopy("_SPFIN_","_SPFOUT_");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
if fexist("_SPFOUT_") then leave;
|
||||
else sleeprc=sleep(0.25,1);
|
||||
end;
|
||||
|
||||
rc4=fexist("_SPFOUT_");
|
||||
length rc4txt $ 8192;
|
||||
rc4txt=sysmsg();
|
||||
|
||||
if rc4 then
|
||||
@@ -4589,7 +4598,7 @@ TODO: (in Polish)
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20230411. Run %loadPackages() for help info.'
|
||||
des = 'Macro to load multiple SAS packages at one run, version 20230520. Run %loadPackages() for help info.'
|
||||
parmbuff
|
||||
;
|
||||
%if (%superq(packagesNames) = ) OR (%qupcase(&packagesNames.) = HELP) %then
|
||||
@@ -4605,7 +4614,7 @@ parmbuff
|
||||
%put ### This is short help information for the `loadPackageS` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20230411` #;
|
||||
%put # Macro wrapper for the loadPackage macro, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -4702,7 +4711,7 @@ parmbuff
|
||||
hashing_file() function, SAS 9.4M6 */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20230411. Run %verifyPackage() for help info.'
|
||||
des = 'Macro to verify SAS package with the hash digest, version 20230520. Run %verifyPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -4717,7 +4726,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20230411. Run %
|
||||
%put ### This is short help information for the `verifyPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20230411` #;
|
||||
%put # Macro to verify SAS package with it hash digest, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -4896,7 +4905,7 @@ des = 'Macro to verify SAS package with the hash digest, version 20230411. Run %
|
||||
*/
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to preview content of a SAS package, version 20230411. Run %previewPackage() for help info.'
|
||||
des = 'Macro to preview content of a SAS package, version 20230520. Run %previewPackage() for help info.'
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
%do;
|
||||
@@ -4911,7 +4920,7 @@ des = 'Macro to preview content of a SAS package, version 20230411. Run %preview
|
||||
%put ### This is short help information for the `previewPackage` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to get previwe of a SAS packages, version `20230411` #;
|
||||
%put # Macro to get previwe of a SAS packages, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -5038,7 +5047,7 @@ des = 'Macro to preview content of a SAS package, version 20230411. Run %preview
|
||||
when empty the "packages" value is used */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20230411. Run %extendPackagesFileref(HELP) for help info.'
|
||||
des = 'Macro to list directories pointed by "packages" fileref, version 20230520. Run %extendPackagesFileref(HELP) for help info.'
|
||||
;
|
||||
|
||||
%if %QUPCASE(&packages.) = HELP %then
|
||||
@@ -5054,7 +5063,7 @@ des = 'Macro to list directories pointed by "packages" fileref, version 20230411
|
||||
%put ### This is short help information for the `extendPackagesFileref` macro #;
|
||||
%put #-----------------------------------------------------------------------------------------#;;
|
||||
%put # #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20230411` #;
|
||||
%put # Macro to list directories pointed by 'packages' fileref, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -5155,7 +5164,7 @@ filename packages list;
|
||||
is provided in required version */
|
||||
)/secure
|
||||
/*** HELP END ***/
|
||||
des = 'Macro to load additional content for a SAS package, version 20230411. Run %loadPackageAddCnt() for help info.'
|
||||
des = 'Macro to load additional content for a SAS package, version 20230520. Run %loadPackageAddCnt() for help info.'
|
||||
minoperator
|
||||
;
|
||||
%if (%superq(packageName) = ) OR (%qupcase(&packageName.) = HELP) %then
|
||||
@@ -5171,7 +5180,7 @@ minoperator
|
||||
%put ### This is short help information for the `loadPackageAddCnt` macro #;
|
||||
%put #-------------------------------------------------------------------------------#;
|
||||
%put # #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20230411` #;
|
||||
%put # Macro to *load* additional content for a SAS package, version `20230520` #;
|
||||
%put # #;
|
||||
%put # A SAS package is a zip file containing a group #;
|
||||
%put # of SAS codes (macros, functions, data steps generating #;
|
||||
@@ -5356,14 +5365,17 @@ minoperator
|
||||
call symputx("AdditionalContent", 0, "L");
|
||||
|
||||
rc1=filename("in", pathname("&_PackageFileref_."), "ZIP", "lrecl=1 recfm=n member='addcnt.zip'");
|
||||
length rc1txt $ 8192;
|
||||
rc1txt=sysmsg();
|
||||
|
||||
if fexist("in") then
|
||||
do;
|
||||
rc2=filename("out", pathname("WORK")!!"/%lowcase(&packageName.)addcnt.zip", "disk", "lrecl=1 recfm=n");
|
||||
length rc2txt $ 8192;
|
||||
rc2txt=sysmsg();
|
||||
|
||||
rc3=fcopy("in","out");
|
||||
length rc3txt $ 8192;
|
||||
rc3txt=sysmsg();
|
||||
|
||||
if rc3 then put _N_ @12 (rc:) (=);
|
||||
@@ -5400,6 +5412,7 @@ minoperator
|
||||
end;
|
||||
if did then
|
||||
do i=1 to dnum(did);
|
||||
length file $ 8192;
|
||||
file = dread(did, i);
|
||||
output;
|
||||
keep file;
|
||||
@@ -5411,6 +5424,7 @@ minoperator
|
||||
set WORK.__&_TargetFileref_._zip___ end = EOF;
|
||||
wc = countw(file,"/\");
|
||||
|
||||
length libText pathname_f $ 8192;
|
||||
libText = pathname("outData", "L");
|
||||
|
||||
if scan(file, wc , "/\") = "" then
|
||||
@@ -5426,12 +5440,17 @@ minoperator
|
||||
rc = libname("test", libText);
|
||||
rc = libname("test");
|
||||
end;
|
||||
rc1 = filename("in", pathname("f"), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
|
||||
|
||||
pathname_f = pathname("f");
|
||||
rc1 = filename("in", strip(pathname_f), "zip", "member='" !! strip(file) !! "' lrecl=1 recfm=n");
|
||||
length rc1txt $ 8192;
|
||||
rc1msg = sysmsg();
|
||||
rc2 = filename("out", catx("/", libText, scan(file, j , "/\")), "disk", "lrecl=1 recfm=n");
|
||||
length rc2txt $ 8192;
|
||||
rc2msg = sysmsg();
|
||||
|
||||
rc3 = fcopy("in", "out");
|
||||
length rc3txt $ 8192;
|
||||
rc3msg = sysmsg();
|
||||
|
||||
loadingProblem + (rc3 & 1);
|
||||
|
||||
@@ -86,7 +86,7 @@ SHA256 digest for macroArray: F*85E3BE4D163AC5223B6EC9D3C25C46564A656E3830998B45
|
||||
|
||||
---
|
||||
|
||||
- **BasePlus**\[1.19.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
- **BasePlus**\[1.24.1\] adds a bunch of functionalities I am missing in BASE SAS, such as:
|
||||
```sas
|
||||
call arrMissToRight(myArray);
|
||||
call arrFillMiss(17, myArray);
|
||||
@@ -107,8 +107,10 @@ format x bool.;
|
||||
%bpPIPE(ls -la ~/)
|
||||
|
||||
%dirsAndFiles(C:\SAS_WORK\,ODS=work.result)
|
||||
|
||||
%put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$);
|
||||
```
|
||||
SHA256 digest for BasePlus: F*B5BF05531BF78DCEBC436BD93311FED0436D83AA3D106ABFBAD96B04C7D63DF2
|
||||
SHA256 digest for BasePlus: F*0CCAA009D64CC20ED315FA123C233E0383967E635EB8708E7A48EEE3767C6BC5
|
||||
|
||||
[Documentation for BasePlus](https://github.com/yabwon/SAS_PACKAGES/blob/main/packages/baseplus.md "Documentation for BasePlus")
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
/* 20230520 */
|
||||
BasePlus: F*0CCAA009D64CC20ED315FA123C233E0383967E635EB8708E7A48EEE3767C6BC5
|
||||
|
||||
/* 20230503 */
|
||||
BasePlus: F*B297440903337E1AE6F12A6001B80B8AB743079847D16D63DF1C649AE51AA411
|
||||
|
||||
/* 20230419 */
|
||||
BasePlus: F*625E56B017C4AA8D436959C0A03C8503773A9A3823D43FA9E0326276E52DA6F2
|
||||
|
||||
/* 20230417 */
|
||||
BasePlus: F*F39F38CE80A5D8EED3BC9F2413CD6DEF38E8657E5DCF427CBA8938EB8C4350B6
|
||||
|
||||
/* 20230411 */
|
||||
BasePlus: F*B5BF05531BF78DCEBC436BD93311FED0436D83AA3D106ABFBAD96B04C7D63DF2
|
||||
DFA: F*924711C77E413B8CFC18336DDA2293A9F5294D02E267C1BB7BC876B4AF0AABE4
|
||||
|
||||
@@ -51,12 +51,23 @@
|
||||
* [`%LVarNmLab()` macro](#lvarnmlab-macro)
|
||||
* [`%bpPIPE()` macro](#bppipe-macro)
|
||||
* [`%dirsAndFiles()` macro](#dirsandfiles-macro)
|
||||
* [`%repeatTxt()` macro](#repeattxt-macro)
|
||||
* [`%intsList()` macro](#intslist-macro)
|
||||
* [`%letters()` macro](#letters-macro)
|
||||
* [`%splitDSIntoBlocks()` macro](#splitdsintoblocks-macro)
|
||||
* [`%splitDSIntoParts()` macro](#splitdsintoparts-macro)
|
||||
* [`%filePath()` macro](#filepath-macro)
|
||||
* [`%libPath()` macro](#libpath-macro)
|
||||
* [`%workPath()` macro](#workpath-macro)
|
||||
* [`%translate()` macro](#translate-macro)
|
||||
* [`%tranwrd()` macro](#tranwrd-macro)
|
||||
|
||||
|
||||
* [License](#license)
|
||||
|
||||
---
|
||||
|
||||
# The BasePlus package [ver. 1.19.1] <a name="baseplus-package"></a> ###############################################
|
||||
# The BasePlus package [ver. 1.24.1] <a name="baseplus-package"></a> ###############################################
|
||||
|
||||
The **BasePlus** package implements useful
|
||||
functions and functionalities I miss in the BASE SAS.
|
||||
@@ -198,7 +209,6 @@ Recording from the SAS Explore 2022 conference: [A BasePlus Package for SAS](htt
|
||||
%rainCloudPlot(sashelp.cars,DriveTrain,Invoice)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**Example 10**: Zip SAS library.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%zipLibrary(sashelp, libOut=work)
|
||||
@@ -231,69 +241,105 @@ run;
|
||||
%dirsAndFiles(C:\SAS_WORK\,ODS=work.result)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 14** Text repetition:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 15** Integer list:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %intsList(42);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 16** Split dataset into blocks of 5 observations:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoBlocks(5, sashelp.class, classBlock)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 17** Split dataset into 7 parts:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoParts(7, sashelp.cars, carsPart)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 18** Return path to temporary file:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
filename f temp;
|
||||
%put %filePath(f);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
Package contains:
|
||||
1. macro bppipe
|
||||
2. macro deduplistc
|
||||
3. macro deduplistp
|
||||
4. macro deduplists
|
||||
5. macro deduplistx
|
||||
6. macro dirsandfiles
|
||||
7. macro functionexists
|
||||
8. macro getvars
|
||||
9. macro ldsn
|
||||
10. macro ldsnm
|
||||
11. macro lvarnm
|
||||
12. macro lvarnmlab
|
||||
13. macro qdeduplistx
|
||||
14. macro qgetvars
|
||||
15. macro qzipevalf
|
||||
16. macro raincloudplot
|
||||
17. macro symdelglobal
|
||||
18. macro unziplibrary
|
||||
19. macro zipevalf
|
||||
20. macro ziplibrary
|
||||
21. format bool
|
||||
22. format boolz
|
||||
23. format ceil
|
||||
24. format floor
|
||||
25. format int
|
||||
26. functions arrfill
|
||||
27. functions arrfillc
|
||||
28. functions arrmissfill
|
||||
29. functions arrmissfillc
|
||||
30. functions arrmisstoleft
|
||||
31. functions arrmisstoleftc
|
||||
32. functions arrmisstoright
|
||||
33. functions arrmisstorightc
|
||||
34. functions bracketsc
|
||||
35. functions bracketsn
|
||||
36. functions catxfc
|
||||
37. functions catxfi
|
||||
38. functions catxfj
|
||||
39. functions catxfn
|
||||
40. functions deldataset
|
||||
41. functions semicolonc
|
||||
42. functions semicolonn
|
||||
43. format brackets
|
||||
44. format semicolon
|
||||
45. proto qsortincbyprocproto
|
||||
46. functions frommissingtonumberbs
|
||||
47. functions fromnumbertomissing
|
||||
48. functions quicksort4notmiss
|
||||
49. functions quicksorthash
|
||||
50. functions quicksorthashsddv
|
||||
51. functions quicksortlight
|
||||
1. macro bppipe
|
||||
2. macro deduplistc
|
||||
3. macro deduplistp
|
||||
4. macro deduplists
|
||||
5. macro deduplistx
|
||||
6. macro dirsandfiles
|
||||
7. macro functionexists
|
||||
8. macro getvars
|
||||
9. macro intslist
|
||||
10. macro ldsn
|
||||
11. macro ldsnm
|
||||
12. macro lvarnm
|
||||
13. macro lvarnmlab
|
||||
14. macro qdeduplistx
|
||||
15. macro qgetvars
|
||||
16. macro qzipevalf
|
||||
17. macro raincloudplot
|
||||
18. macro repeattxt
|
||||
19. macro splitdsintoblocks
|
||||
20. macro splitdsintoparts
|
||||
21. macro symdelglobal
|
||||
22. macro unziplibrary
|
||||
23. macro zipevalf
|
||||
24. macro ziplibrary
|
||||
25. format bool
|
||||
26. format boolz
|
||||
27. format ceil
|
||||
28. format floor
|
||||
29. format int
|
||||
30. function arrfill
|
||||
31. function arrfillc
|
||||
32. function arrmissfill
|
||||
33. function arrmissfillc
|
||||
34. function arrmisstoleft
|
||||
35. function arrmisstoleftc
|
||||
36. function arrmisstoright
|
||||
37. function arrmisstorightc
|
||||
38. function bracketsc
|
||||
39. function bracketsn
|
||||
40. function catxfc
|
||||
41. function catxfi
|
||||
42. function catxfj
|
||||
43. function catxfn
|
||||
44. function deldataset
|
||||
45. function semicolonc
|
||||
46. function semicolonn
|
||||
47. format brackets
|
||||
48. format semicolon
|
||||
49. proto qsortincbyprocproto
|
||||
50. function frommissingtonumberbs
|
||||
51. function fromnumbertomissing
|
||||
52. function quicksort4notmiss
|
||||
53. function quicksorthash
|
||||
54. function quicksorthashsddv
|
||||
55. function quicksortlight
|
||||
56. macro filepath
|
||||
57. macro letters
|
||||
58. macro libpath
|
||||
59. macro translate
|
||||
60. macro tranwrd
|
||||
61. macro workpath
|
||||
|
||||
Package contains additional content, run: %loadPackageAddCnt(BasePlus) to load it
|
||||
or look for the baseplus_AdditionalContent directory in the Packages fileref
|
||||
localization (only if additional content was deployed during the installation process).
|
||||
|
||||
* SAS package generated by generatePackage, version 20230411 *
|
||||
* SAS package generated by generatePackage, version 20230520 *
|
||||
|
||||
The SHA256 hash digest for package BasePlus:
|
||||
`F*B5BF05531BF78DCEBC436BD93311FED0436D83AA3D106ABFBAD96B04C7D63DF2`
|
||||
`F*0CCAA009D64CC20ED315FA123C233E0383967E635EB8708E7A48EEE3767C6BC5`
|
||||
|
||||
---
|
||||
# Content description ############################################################################################
|
||||
@@ -3072,7 +3118,9 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
<,y2axisValueAttrs=>
|
||||
<,xaxisValueAttrs=>
|
||||
<,xaxisTickstyle=>
|
||||
|
||||
<,sganno=>
|
||||
<,odsGraphicsOptions=>
|
||||
<,sgPlotOptions=>
|
||||
|
||||
<,VSCALE=>
|
||||
<,KERNEL_K=>
|
||||
@@ -3178,6 +3226,19 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
Allowed values are `OUTSIDE`, `INSIDE`, `ACROSS`, and `INBETWEEN`.
|
||||
*For SAS previous to* **9.4M5** *set to missing!*
|
||||
|
||||
* `sganno` - *Optional*, default value is empty.
|
||||
keeps name of a data set for the `sganno=` option
|
||||
of the SGPLOT procedure.
|
||||
|
||||
* `sgPlotOptions` - *Optional*, default value is `noautolegend noborder`.
|
||||
List of additional options values for SGPLOT procedure.
|
||||
|
||||
* `odsGraphicsOptions` - *Optional*, default value is empty.
|
||||
List of additional options values for `ODS Graphics` statement.
|
||||
By default only the: `width=`, `height=`, and `antialiasmax=`
|
||||
are modified.
|
||||
|
||||
|
||||
***Stat related options***:
|
||||
|
||||
* `VSCALE` - *Optional*, default value `Proportion`.
|
||||
@@ -3308,6 +3369,56 @@ The output:
|
||||

|
||||
|
||||
|
||||
|
||||
**EXAMPLE 3.** Rain Cloud plot with formated groups:
|
||||
and annotations.
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
|
||||
data annotation;
|
||||
function="text";
|
||||
label="This graph is full(*ESC*){sup '2'} of annotations!";
|
||||
drawspace="graphpercent";
|
||||
rotate=30;
|
||||
anchor="center";
|
||||
textsize=32;
|
||||
x1=50;
|
||||
y1=50;
|
||||
textcolor="red";
|
||||
justify="center";
|
||||
textweight="bold";
|
||||
width=100;
|
||||
widthunit="percent";
|
||||
run;
|
||||
|
||||
proc format;
|
||||
value system
|
||||
1="Windows"
|
||||
2="MacOS"
|
||||
3="Linux"
|
||||
;
|
||||
run;
|
||||
|
||||
data test;
|
||||
do system = 1 to 3;
|
||||
do i = 1 to 30;
|
||||
x = rannor(123)/system;
|
||||
output;
|
||||
end;
|
||||
end;
|
||||
format system system.;
|
||||
run;
|
||||
|
||||
|
||||
%RainCloudPlot(test, system, x
|
||||
, formated=1
|
||||
, sganno=annotation
|
||||
, sgPlotOptions=noborder
|
||||
, WidthPX=2000
|
||||
, HeightPX=420
|
||||
)
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%zipLibrary()` macro: <<< <a name="ziplibrary-macro"></a> #######################
|
||||
@@ -4123,10 +4234,648 @@ The basic syntax is the following, the `<...>` means optional parameters:
|
||||
%dirsAndFiles(%sysfunc(pathname(WORK))/noSuchDir,ODS=work.result12,details=1)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%repeatTxt()` macro: <<< <a name="repeattxt-macro"></a> #######################
|
||||
|
||||
The repeatTxt() macro function allows to repeat `n`
|
||||
times a `text` string separated by string `s=`.
|
||||
|
||||
The repeatTxt() returns unquoted value [by %unquote()].
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%repeatTxt()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%repeatTxt(
|
||||
text
|
||||
<,n>
|
||||
<,s=>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `text` - *Required*, a text to be repeated.
|
||||
|
||||
2. `n` - *Required/Optional*, the number of repetitions.
|
||||
If missing then set to `1`;
|
||||
|
||||
* `s = %str( )` - *Optional*, it is a separator between
|
||||
repeated elements. Default value is space.
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Simple repetition of dataset name:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options mprint;
|
||||
data work.test5;
|
||||
set
|
||||
%repeatTxt(sashelp.cars, 5)
|
||||
;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Simple repetition of data step:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options mprint;
|
||||
%repeatTxt(data _null_; set sashelp.cars; run;, 3)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** "Nice" output:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 4.** Macroquote a text with commas:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%repeatTxt(
|
||||
%str(proc sql; create table wh as select weight,height from sashelp.class; quit;)
|
||||
,3
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 5.** Empty `n` repeats `text` one time:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options mprint;
|
||||
data work.test1;
|
||||
set
|
||||
%repeatTxt(sashelp.cars)
|
||||
;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**EXAMPLE 6.** Dynamic "formatting":
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%macro printWork();
|
||||
%let work=%sysfunc(pathname(work));
|
||||
%put +%repeatTxt(~,%length(&work.)+5,s=)+;
|
||||
%put {&=work.};
|
||||
%put +%repeatTxt(~,%length(&work.)+5,s=)+;
|
||||
%mend printWork;
|
||||
|
||||
%printWork()
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%intsList()` macro: <<< <a name="intslist-macro"></a> #######################
|
||||
|
||||
The intsList() macro function allows to print a list of
|
||||
integers starting from `start` up to `end` incremented by `by`
|
||||
and separated by `sep=`.
|
||||
|
||||
If `start`, `end` or `by` are non-integers the are converted to integers.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%intsList()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%intsList(
|
||||
start
|
||||
<,end>
|
||||
<,by>
|
||||
<,sep=>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `start` - *Required*, the first value of the list.
|
||||
If `end` is missing then the list is generated
|
||||
from 1 to `start` by 1.
|
||||
|
||||
2. `end` - *Required/Optional*, the last value of the list.
|
||||
|
||||
3. `by` - *Required/Optional*, the increment of the list.
|
||||
If missing then set to `1`.
|
||||
*Cannot* be equal to `0`.
|
||||
|
||||
* `s = %str( )` - *Optional*, it is a separator between
|
||||
elements of the list. Default value is space.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Simple list of integers from 1 to 10 by 1:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %intsList(10);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Ten copies of `sashelp.class` in `test11` to `test20`:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data
|
||||
%zipEvalf(test, %intsList(11,20))
|
||||
;
|
||||
set sashelp.class;
|
||||
run;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Non-integers are converted to integers, the list is `1 3 5`:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %intsList(1.1,5.2,2.3);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 4.** A list with a separator:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %intsList(1,5,2,sep=+);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%letters()` macro: <<< <a name="letters-macro"></a> #######################
|
||||
|
||||
The letters() macro function allows to print a list of Roman
|
||||
letters starting from `start` up to `end` incremented by `by`.
|
||||
The letters list can be uppercases or lowercase (parameter `c=U` or `c=L`),
|
||||
can be quoted (e.g. `q=""` or `q=[]`), and can be separated by `s=`.
|
||||
|
||||
Values of `start`, `end`, and `by` have to be integers in range between 1 ad 26.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%letters()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%letters(
|
||||
range
|
||||
<,c=>
|
||||
<,q=>
|
||||
<,s=>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `range` - *Required*, letters selector in form `start:end:by`.
|
||||
Lists letters from `start` to `end` by `by`.
|
||||
Values of `start`, `end`, and `by` are separated by
|
||||
colon and must be between 1 ad 26.
|
||||
If value is outside range it is set to
|
||||
`start=1`, `en=26`, and `by=1`. If `end` is missing
|
||||
then is set to value of `start`.
|
||||
If `end` is smaller than `start` list is reversed
|
||||
|
||||
* `c = U` - *Optional*, it is a lowercase letters indicator.
|
||||
Select `L` or `l`. Default value is `U` for upcase.
|
||||
|
||||
* `q = ` - *Optional*, it is a quite around elements of the list.
|
||||
Default value is empty. Use `%str()` for one quote symbol.
|
||||
If there are multiple symbols, only the first and the
|
||||
second are selected as a preceding and trailing one,
|
||||
e.g. `q=[]` gives `[A] [B] ... [Z]`.
|
||||
|
||||
* `s = %str( )` - *Optional*, it is a separator between
|
||||
elements of the list. Default value is space.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Space separated list of capital letters from A to Z:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1:26:1);
|
||||
|
||||
%put %letters();
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** First, thirteenth, and last letter:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1) %letters(13) %letters(26);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Every third lowercase letter, i.e. `a d g j m p s v y`:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1:26:3,c=L);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 4.** Lists with separators:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1:26:2,s=#);
|
||||
%put %letters(1:26:3,s=%str(;));
|
||||
%put %letters(1:26:4,s=%str(,));
|
||||
%put %letters(1:26,s=);
|
||||
%put %letters(1:26,s==);
|
||||
%put %letters(1:26,s=/);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 5.** Every second letter with quotes:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1:26:2,q=%str(%'));
|
||||
%put %letters(2:26:2,q=%str(%"));
|
||||
|
||||
%put %letters(1:26:2,q='');
|
||||
%put %letters(2:26:2,q="");
|
||||
|
||||
%put %letters(1:26:2,q=<>);
|
||||
%put %letters(2:26:2,q=\/);
|
||||
|
||||
%put %letters(1:26:2,q=());
|
||||
%put %letters(2:26:2,q=][);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 6.** Mix of examples 4, 5, and 6:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(1:26,c=L,q='',s=%str(, ));
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 7.** If `end` is smaller than `start` list is reversed:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %letters(26:1:2,q='');
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%splitDSIntoBlocks()` macro: <<< <a name="splitdsintoblocks-macro"></a> #######################
|
||||
|
||||
The splitDSIntoBlocks() macro allows to split the `set` dataset into blocks
|
||||
of size `blockSize` in datasets: `prefix1` to `prefixN`.
|
||||
|
||||
The last dataset may have less observations then the `blockSize`.
|
||||
|
||||
Macro covers `BASE` engine (`v9`, `v8`, `v7`, `v6`) and `SPDE` engine datasets.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoBlocks(
|
||||
blockSize
|
||||
<,set>
|
||||
<,prefix>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `blockSize` - *Required*, the size of the block of data,
|
||||
in other words number of observations in
|
||||
one block of split data.
|
||||
Block size must be positive integer.
|
||||
|
||||
2. `set` - *Required/Optional*, the name of the dataset to split.
|
||||
If empty then `&syslast.` is used.
|
||||
|
||||
3. `prefix` - *Required/Optional*, the name-prefix for new datasets.
|
||||
If missing then set to `part`.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Split `sashelp.class` into 5 elements datasets ABC1 to ABC4:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoBlocks(5,sashelp.class,ABC)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** By default splits the `_last_` dataset into `part1` to `partN` datasets:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data lastData;
|
||||
set sashelp.cars;
|
||||
run;
|
||||
|
||||
%splitDSIntoBlocks(123)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Works with `SPDE` engine too:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options dlcreatedir;
|
||||
libname test "%sysfunc(pathname(work))/testSPDE";
|
||||
libname test;
|
||||
libname test SPDE "%sysfunc(pathname(work))/testSPDE";
|
||||
|
||||
data test.test;
|
||||
set sashelp.cars;
|
||||
run;
|
||||
|
||||
%splitDSIntoBlocks(100,test.test,work.spde)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%splitDSIntoParts()` macro: <<< <a name="splitdsintoparts-macro"></a> #######################
|
||||
|
||||
The splitDSIntoParts() macro allows to split the `set` dataset into `parts` parts
|
||||
of approximately `NOBS/parts` size in datasets: `prefix1` to `prefixN`.
|
||||
|
||||
The splitDSIntoParts() macro internally runs the splitDSIntoBlocks() macro.
|
||||
|
||||
Macro covers `BASE` engine (`v9`, `v8`, `v7`, `v6`) and `SPDE` engine datasets.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoParts(
|
||||
parts
|
||||
<,set>
|
||||
<,prefix>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `parts` - *Required*, the number of parts to split data into.
|
||||
Number of parts must be positive integer.
|
||||
|
||||
2. `set` - *Required/Optional*, the name of the dataset to split.
|
||||
If empty then `&syslast.` is used.
|
||||
|
||||
3. `prefix` - *Required/Optional*, the name-prefix for new datasets.
|
||||
If missing then set to `part`.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Split `sashelp.cars` into 7 parts: datasets carsInParts1 to carsInParts7:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%splitDSIntoParts(7,sashelp.cars, carsInParts)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** By default splits the `_last_` dataset into `part1` to `part3` datasets:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
data lastData;
|
||||
set sashelp.cars;
|
||||
run;
|
||||
|
||||
%splitDSIntoBlocks(3)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Works with `SPDE` engine too:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options dlcreatedir;
|
||||
libname test "%sysfunc(pathname(work))/testSPDE";
|
||||
libname test;
|
||||
libname test SPDE "%sysfunc(pathname(work))/testSPDE";
|
||||
|
||||
data test.test;
|
||||
set sashelp.cars;
|
||||
run;
|
||||
|
||||
%splitDSIntoParts(3,test.test,work.spde)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%filePath()` macro: <<< <a name="filepath-macro"></a> #######################
|
||||
|
||||
The filePath() macro function returns path to a file,
|
||||
it is a wrapper to `pathname()` function for files.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%filePath()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%filePath(
|
||||
fileref
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `fileref` - *Required*, a fileref from the `filename` statement.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Return path to temporary file:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
filename f temp;
|
||||
%put %filePath(f);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%libPath()` macro: <<< <a name="libpath-macro"></a> #######################
|
||||
|
||||
The libPath() macro function returns path to a library,
|
||||
it is a wrapper to `pathname()` function for libraries.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%libPath()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%libPath(
|
||||
libref
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `libref` - *Required*, a libref from the `libname` statement.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Return path to `WORK` library:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %libPath(WORK);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Return path to `SASHELP` library:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %libPath(SASHELP);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%workPath()` macro: <<< <a name="workpath-macro"></a> #######################
|
||||
|
||||
The workPath() macro function returns path to the `WORK` library,
|
||||
it is a wrapper to `pathname("work", "L")` function.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%workPath()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%workPath()
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
*) No arguments.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Create new library inside `WORK` library:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
options dlCreateDir;
|
||||
libname NEW "%workPath()/new";
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%translate()` macro: <<< <a name="translate-macro"></a> #######################
|
||||
|
||||
The translate() macro function allows to replace bytes with bytes in text string.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%translate()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%translate(
|
||||
string
|
||||
,from
|
||||
,to
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `string` - *Required*, string to modify.
|
||||
|
||||
2. `from` - *Required*, list of bytes to be replaced with
|
||||
corresponding bytes from `to`.
|
||||
|
||||
3. `to` - *Required*, list of bytes replacing
|
||||
corresponding bytes from `from`.
|
||||
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Replace quotes and commas with apostrophes and spaces:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %translate(%str("A", "B", "C"),%str(%",),%str(%' ));
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Unify all brackets;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %translate(%str([A] {B} (C) <D>),{[(<>)]},(((()))));
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Replace all digits with `*`:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %translate(QAZ1WSSX2EDC3RFV4TGB5YHN6UJM7IK8OL9P0,1234567890,**********);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 4.** Letters change:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %translate(%str(A=B),AB,BA);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
## >>> `%tranwrd()` macro: <<< <a name="tranwrd-macro"></a> #######################
|
||||
|
||||
The tranwrd() macro function allows to replace substrings
|
||||
with other substrings in text string.
|
||||
|
||||
Returned string is unquoted by `%unquote()`.
|
||||
|
||||
See examples below for the details.
|
||||
|
||||
The `%tranwrd()` macro executes like a pure macro code.
|
||||
|
||||
### SYNTAX: ###################################################################
|
||||
|
||||
The basic syntax is the following, the `<...>` means optional parameters:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%tranwrd(
|
||||
string
|
||||
,from
|
||||
,to
|
||||
<,repeat>
|
||||
)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
**Arguments description**:
|
||||
|
||||
1. `string` - *Required*, string to modify.
|
||||
|
||||
2. `from` - *Required*, substring replaced with
|
||||
corresponding string from `to`.
|
||||
|
||||
3. `to` - *Required*, substring replacing
|
||||
corresponding substring from `from`.
|
||||
|
||||
4. `repeat` - *Optional*, number of times the replacing
|
||||
should be repeated, default is 1.
|
||||
Useful while removing multiple adjacent
|
||||
characters, e.g. compress all multiple
|
||||
spaces (see example 2).
|
||||
---
|
||||
|
||||
### EXAMPLES AND USECASES: ####################################################
|
||||
|
||||
**EXAMPLE 1.** Simple text replacement:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %tranwrd(Miss Joan Smith,Miss,Ms.);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 2.** Delete multiple spaces;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %tranwrd(%str(A B C),%str( ),%str( ),5);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
**EXAMPLE 3.** Remove substring:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~sas
|
||||
%put %tranwrd(ABCxyzABCABCxyzABC,ABC);
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user