The BasePlus package [ver. 1.19.0] package is here.
Within last month it happened twice (here and here) that I suggested Kurt Bremser's (@Kurt_Bremser) article "Talking to Your Host" (presented at WUSS 2022 conference) as a solution to a particular task. The task was more or less "extract list of files and subdirectories of a given directory and do something with that list".
Since "used twice" means "repeatable" - I decided to wrap-up Kurt's code into a macro and add it to the BasePlus package.
%dirsAndFiles() macro was added to the package. The macro allows to extract info about all files and subdirectories of a given
root directory into a data set, for example:
Macro has several additional parameters which allows to alter the result data set. The macro and the parameters are described in the documentation.
Let me know if you find it useful. 🙂
All the best
New version of SAS Packages Framework was released, note here: https://communities.sas.com/t5/SAS-Programming/SAS-Packages-Framework-version-20230411/m-p/869151#M3...
and also the BasePlus was regenerated. Current version is 1.19.1
Just small update.
%repeatTxt() utility macro function allows to repeat
n times a
text string separated by string
s=, for example:
%put %repeatTxt(#,15,s=$) HELLO SAS! %repeatTxt(#,15,s=$); data work.cars5; set %repeatTxt(sashelp.cars, 5) ; run;
Yet another update.
1.23.0] details here
%intsList()- prints a space separated list of integers
%splitDSIntoBlocks()- splits dataset into block of given size (and one[the last] possibly smaller)
%splitDSIntoParts()- splits dataset into given number of parts (of approximately same size)
splitDSIntoParts supports BASE and SPDE engines.
EXAMPLE 1: Print integer list from 17 to 42 by 1:
EXAMPLE 2: Split
sashelp.class dataset into blocks of 5 observations:
%splitDSIntoBlocks(5, sashelp.class, classBlock)
EXAMPLE 3: Split
sashelp.cars dataset into 7 parts:
%splitDSIntoParts(7, sashelp.cars, carsPart)
New release of BasePlus. I added few "one-liners" inspired by latest discussions here at communities.
1.24.0] details here.
%letters()- allows to print a list of Roman letters,
%filePath()- from fileref returns path to a file,
%libPath()- from libref returns path to a library,
%workPath()- returns path to the
%translate()- a wrapper to translate() function,
%tranwrd()- a wrapper to tranwrd() function.
EXAMPLE 1. Every third lowercase letter, i.e.
a d g j m p s v y:
EXAMPLE 2. Return path to temporary file:
filename f temp; %put %filePath(f);
EXAMPLE 3. Return path to
EXAMPLE 4. Create new library inside
options dlCreateDir; libname NEW "%workPath()/new";
EXAMPLE 5. Replace quotes and commas with apostrophes and spaces:
%put %translate(%str("A","B","C"),%str(%",),%str(%' ));
%put %tranwrd(Miss Joan Smith,Miss,Ms.);
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.