BookmarkSubscribeRSS Feed
yabwon
Onyx | Level 15

Hey SAS-C!

 

"Trick or treat" season is in bloom and the SPF has a new treat for developers.
This release "treat" is brand new utility macro that allows you to do some usefully "tricks" when you want to create a packages structure from "one-big-code" file. Details below.

 

All the best

Bart

 

SAS Packages Framework, version 20241027

As usual available at: https://github.com/yabwon/SAS_PACKAGES 

Changes:


New simple utility macro: %splitCodeForPackage() added to the framework. Now we have a dozen!

The macro is a "helping-hand" for those developers who have a "one-big-code" file and want to turn it into a package structure (separate files in subdirectories) but are to lazy to do it manually. Whit help of additional tags the macro automatically splits the code file according to the developer's wish.

Run:

%splitCodeForPackage(HELP)
 

to see more details or, probably even better, visit the Documentation and Hands-on-Workshops materials to learn how %splitCodeForPackage() works .


Example:

Let's assume that the myPackageCode.sas file is located in the C:/lazy/ folder and contain the following code and tags:

/*##$##-code-block-start-##$## 01_macro(abc) */
%macro abc();
  %put I am "abc".;
%mend abc;
/*##$##-code-block-end-##$## 01_macro(abc) */

/*##$##-code-block-start-##$## 01_macro(efg) */
%macro efg();
  %put I am "efg".;
%mend efg;
/*##$##-code-block-end-##$## 01_macro(efg) */

proc FCMP outlib=work.f.p;
/*##$##-code-block-start-##$## 02_functions(xyz) */
function xyz(n);
  return(n**2 + n + 1)
endfunc;
/*##$##-code-block-end-##$## 02_functions(xyz) */
quit;
 

and we want results in C:/split/ folder. We run the following:

filename packages "C:/SAS_PACKAGES"; %* a directory for the framework and packages;
%include packages(SPFinit.sas);      %* enable the framework;

%splitCodeForPackage(
   codeFile=C:/lazy/myPackageCode.sas
  ,packagePath=C:/split/ )
 

As a result two subdirectories 01_macro and 02_functions are created inside C:/split/. The first contains two files: abc.sas and efg.sas with corresponding macros definitions, the second contains xyz.sas file with definition of the xyz function.

Nesting, overlapping, and multiple file redirection is supported.

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



3 REPLIES 3
himself
Pyrite | Level 9
Hi my friend , yabwon, I have always been having interest on learning how SAS frameworks operates, please let me know how they operate. Thanks
yabwon
Onyx | Level 15

Here is the link to a list of recordings about SAS Packages framework: https://github.com/yabwon/SAS_PACKAGES?tab=readme-ov-file#recordings-and-presentations

 

The latest one is: "SAS Packages Framework - an easy code sharing medium for SAS" - Warsaw IT Days 2023 (March 31st 2023, ~60 minutes, general overview with technical details for user and developer)

 

Here is the link to materials form workshops on the topic ("from 0 to Hero"): https://github.com/yabwon/HoW-SASPackages

 

Bart

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



yabwon
Onyx | Level 15

SAS Packages Framework, version 20241102

https://communities.sas.com/t5/SAS-Programming/SAS-Packages-Framework-version-20241102/td-p/949786

 

_______________
Polish SAS Users Group: www.polsug.com and communities.sas.com/polsug

"SAS Packages: the way to share" at SGF2020 Proceedings (the latest version), GitHub Repository, and YouTube Video.
Hands-on-Workshop: "Share your code with SAS Packages"
"My First SAS Package: A How-To" at SGF2021 Proceedings

SAS Ballot Ideas: one: SPF in SAS, two, and three
SAS Documentation



hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1315 views
  • 4 likes
  • 2 in conversation