---
title: SAS Packageの作り方/使い方--SAS Package and PharmaForest ハンズオンセミナー
tags:  #[第12回大阪sas勉強会]  
author: [森岡裕[SASユーザー総会世話人]](https://convert.docswell.com/user/6484025)
site: [Docswell](https://www.docswell.com/)
thumbnail: https://bcdn.docswell.com/page/GE89LPMX7D.jpg?width=480
description: SAS Packageの作り方/使い方--SAS Package and PharmaForest ハンズオンセミナー by 森岡裕[SASユーザー総会世話人]
published: January 27, 26
canonical: https://convert.docswell.com/s/6484025/ZM6MEN-2026-01-27-062237
---
# Page. 1

![Page Image](https://bcdn.docswell.com/page/GE89LPMX7D.jpg)

How to Create SAS packages
Ryo Nakaya


# Page. 2

![Page Image](https://bcdn.docswell.com/page/LELWL13NJR.jpg)

What is SAS Packages?
• SAS macros, functions, data, etc. are packaged in a unified form using SAS Packages
Framework (SPF).
https://github.com/yabwon/SAS_PACKAGES
• Package can be created and shared like R
• SASPAC (SAS Packages Archive) Repository
https://github.com/SASPAC
SAS packages were developed by Bartosz
Jablonski * in 2019 and the number of users
has been increasing in recent years
*Takeda pharmaceutical, Warsaw University
of Technology, yabwon
2


# Page. 3

![Page Image](https://bcdn.docswell.com/page/4JM9MWDQEW.jpg)

How to Create SAS Packages
1.
Loading SPF (Setup)
- &gt; next slide(3 lines only! )
1.5. Create a hex logo with ChatGPT, etc.!!
2.
3.
Creating Source Files and Folders for a Package
- &gt; To be explained in the following slides
Execute the% generatePackage () macro
This will result in the creation of a
[packagename] .zip file (package file)
%generatePackage(
filesLocation = C:\your\packages\folder, /* location of the files/folders created above */
)
markdownDoc = 1,
/* Create .md file*/
easyArch = 1
/* create archive files of .zip and .md */
There are other parameters related to
tests, etc. at the time of package
preparation.


# Page. 4

![Page Image](https://bcdn.docswell.com/page/PJRGVY4KE9.jpg)

SPF Setup
filename packages &quot;\Your\Folder\&quot;;
filename SPFinit url &quot;https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas&quot;;
%include SPFinit;
%installPackage(SPFinit)
filename packages &quot;\Your\Folder\&quot;;
%include packages(SPFinit);
Once SPFinit.sas is downloaded to the location of
packages using the above% installPackage (SPFinit),
the following is OK
https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/HelloWorldPackage.md
Installation and Loading Examples
%installPackage(baseplus)
%installPackage(SASPACer, sourcePath = https://github.com/Nakaya-Ryo/SASPACer/raw/main/)
%installPackage(RWDExpress(0.0.1), github = Narusawa-T)
%loadPackage(baseplus)
%loadPackage(SASPACer)
4
%loadPackage () looks like library () in R.


# Page. 5

![Page Image](https://bcdn.docswell.com/page/PEXXZG25EX.jpg)

Source file folder for package
•
Standard Configuration
•
Sequential number (for order of execution at the time of package creation)
•
Object type (e.g. macro) at end
•
Test is the test code at the time of package creation
•
Only numbers, “_ ” and lower case letters
•
Any files other than .sas files are ignored (except for addcnt).
•
Addcnt (Additional contents) will be included in the package
•
“description.sas ” should be an essential file, and“ license.sas ” should be
created (to be explained on a later page)
https://github.com/yabwon/SAS_PACKAGES/blob/628641a6cfb6c5cf900283e9db450c7fe0e386e9/SPF/Documentatio
n/Paper_1079-2021/My%20First%20SAS%20Package%20-%20a%20How%20To.pdf
5
https://github.com/yabwon/SAS_PACKAGES/blob/main/SPF/Documentation/HelloWorldPackage.md


# Page. 6

![Page Image](https://bcdn.docswell.com/page/3EKW84MRED.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Fill in the package
information in this
format such as type
6


# Page. 7

![Page Image](https://bcdn.docswell.com/page/L7312LYGJ5.jpg)

Source file folder for package
•
Examples of sas file content in each folder
7
Standard text in the MIT License
(if liscense.sas file is not present,
the MIT standard text is
prepopulated.)


# Page. 8

![Page Image](https://bcdn.docswell.com/page/87DXZN5NEG.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
File name = Object name
(1 file: 1 object)
(In principle, the same applies to
documents other than libname)
8


# Page. 9

![Page Image](https://bcdn.docswell.com/page/VJPPD5GNJ8.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
It is impossible to describe
Proc format; and run;
(Describe only the contents)
Formats does not need to be 1
file: 1 object.
Note: A folder structure of format (without s) is possible, but the format folder was historically created earlier and should contain a proc format
lib = work. &amp; packageName.format; and run; (Formats is usually more convenient.)
9


# Page. 10

![Page Image](https://bcdn.docswell.com/page/2EV21P6YEQ.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
It is impossible to describe
Proc fcmp; and run;
(Describe only the contents)
Note: A folder structure of function (without s) is possible, but the function folder was historically
created earlier and should contain proc fcmp outlib = work. &amp; packageName.fcmp.package; and run; (I
usually prefer the functionss folder.)
10
For Functions, 1 file: 1 object is
not required.


# Page. 11

![Page Image](https://bcdn.docswell.com/page/57GR2PNWEL.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
Using mylib1 library defined in
01_libname and fmtNum format
defined in 02_formats (so folders
are numbered sequentially)
11


# Page. 12

![Page Image](https://bcdn.docswell.com/page/4EQVP2QQJP.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
The file is not loaded unless
lazyData = is specified in%
loadPackage ().
12


# Page. 13

![Page Image](https://bcdn.docswell.com/page/KJ4MYLNYE1.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
Macro plays a leading role in
package!!
13


# Page. 14

![Page Image](https://bcdn.docswell.com/page/LE186L5N7G.jpg)

Source file folder for package
•
Examples of sas file content in each folder
Help Information
Field
If testPackage = Y (default) is
selected in% generatePackage (),
the test is executed when the
package is created.
14


# Page. 15

![Page Image](https://bcdn.docswell.com/page/GEWZWVWME2.jpg)

Source file folder for package
•
Additional Contents(Addcnt)
%generateP
ackage()
What&#039;s in Addcnt
(Anything Basket)
15
The contents of testPackage.zip (package
file).
Addcnt will be packaged as is in .zip


# Page. 16

![Page Image](https://bcdn.docswell.com/page/47Z1545MJ3.jpg)

Output of %generatePackage ()
Source folder file (input data to be placed in%
generatePackage ())
testPackage.md
(Markdown document based
on description and help
information)
Package body (.zip), instructions (.md),
archive copy (_version)
(Output data from% generatePackage ())
16
Contents of
testPackage.zip
(package body)


# Page. 17

![Page Image](https://bcdn.docswell.com/page/YJ6L9395EV.jpg)

Options to create SAS packages
1.
Manually create source files and folders and run %generatePackage
You can copy existing source packages(e.g. Adamski) as a start point
2.
3.
4.
Use SASPACer
Use SASPACerShiny and run %generatePackage
Ask Oba-chan(SAS Package Lady) to cook source files and folders and run %generatePackage
how_to_create_example_SAS_package.sas


# Page. 18

![Page Image](https://bcdn.docswell.com/page/GJ51NLNG74.jpg)

SASPACer
• Package for Creating SAS package in one step
(A mechanism that you can generally understand when
you look at Sample in Excel)
https://github.com/PharmaForest/SASPACer
• %ex2pac(), %pac2ex()
Output source folder files and package files as input
in Excel.
There is no need to create a folder or file!
%ex2pac(
excel_file = \folder\to\excel_file.xlsx,
package_location = \folder\for\output,
complete_generation = Y
)


# Page. 19

![Page Image](https://bcdn.docswell.com/page/LE312L2P75.jpg)

SASPACerShiny
• For SAS Package Creation using Rshiny
R package (Shiny application)
https://github.com/PharmaForest/SASPACerShiny
Set up source folder files in the graphical user interface
Download and run %generatePackage() separately
%generatePackage(
filesLocation = \path\to\source\package\folder,
markdownDoc = 1,
easyArch = 1)


# Page. 20

![Page Image](https://bcdn.docswell.com/page/8EDXZNZ3JG.jpg)

SAS Package Lady
• The aunty who cooks SAS Package interactively
https://chatgpt.com/g/g68be12f679a88191866ef1e9b35be3c4-sas-package-lady
• Support details
•
Listens to package information
• Can add help information when uploading macro files, etc.
• The system outputs the source package (folder and file
structure)
• They also help me create logos
• Requires chatGPT sign-up (free version OK)
Your aunt will create the source package, download it,
and run %generatePackage() separately.
%generatePackage(
filesLocation = \path\to\source\package\folder,
markdownDoc = 1,
easyArch = 1)


# Page. 21

![Page Image](https://bcdn.docswell.com/page/V7PPD5DP78.jpg)

Enjoy!!


# Page. 22

![Page Image](https://bcdn.docswell.com/page/2JV21P1VJQ.jpg)

References
•
•
•
•
•
•
•
•
•
•
•
SAS Packages: The Way to Share (a How To), SAS Global Forum 2020, Bartosz Jablonski
https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2020/4725-2020.pdf
SASPAC(SAS Packages Repository)
https://github.com/SASPAC
Modern graph package “SAS plotter,” SAS User Group Conference Japan 2024, Kosuke Tsutsugo
https://github.com/SASPAC/sasplotter
Integration of SAS GRID environment and SF-36 Health Survey scoring API with SAS Packages, PharmaSUG 2024, Bartosz
Jablonski
https://pharmasug.org/wp-content/uploads/2024/06/PharmaSUG-2024-SD-262.pdf
SASPAC - Introduction of a certain Github archive-, The 10th Osaka SAS Study Group 2024, Ryo Nakaya,
https://sites.google.com/view/osakasasbenkyokai/%E7%AC%AC10%E5%9B%9E
SASPAC2 - Examination of Real World Data acceleration tool -, The 11th Osaka SAS Study Group 2025, Teruko Narusawa,
https://sites.google.com/view/osakasasbenkyokai/%E7%AC%AC11%E5%9B%9E
PharmaForest
https://github.com/PharmaForest
SASPACer
https://github.com/Nakaya-Ryo/SASPACer
SASPACerShiny
https://github.com/Nakaya-Ryo/SASPACerShiny
SAS Package Lady
https://chatgpt.com/g/g-68be12f679a88191866ef1e9b35be3c4-sas-package-lady
RWDExpress
https://github.com/Narusawa-T/RWDExpress


