К основному содержанию
скилл CX Codex

sas-packages — скилл для Claude Code: установка SAS-пакетов

Скилл-справочник по SAS Packages Framework: ставит, подключает и выгружает SAS-пакеты из архива SASPAC, помогает разобраться с ошибками установки.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add sasjs/skills --skill sas-packages -a claude-code
Открыть на GitHub

Что делает sas-packages

Пакет SAS — это один zip с набором макросов, функций и data step'ов плюс сгенерированные файлы описания, загрузки, выгрузки и справки. Фреймворк SPF (SAS Packages Framework) ставит такие пакеты из папки с архивами, поэтому версию можно зафиксировать и менять пакет, не трогая SASAUTOS и каталог макросов. Скилл описывает работу с фреймворком со стороны потребителя: он не привязан к SASjs, пакеты могут быть от любого автора.

Внутри — правила по fileref packages и разбор четырёх макросов: %installPackage, %helpPackage, %loadPackage, %unloadPackage. Имя fileref обязательно должно быть packages, указывать нужно на существующую папку, а не на zip. Для разовой сессии подойдёт %sysfunc(pathname(work)), для повторного использования — постоянный каталог. Версия пакета фиксируется в скобках: %installPackage(baseplus(1.17)).

Отдельный блок — ловушки. Код rc=20006 означает провал установки, хотя строка выглядит как отчёт об успехе; настоящая причина обычно в том, что папки из fileref нет. На Linux пример C:/SAS_PACKAGES из документации превращается в относительный путь, и установка падает. Сетевой доступ нужен из самой сессии SAS, а не с рабочей машины. Скилл ничего не исполняет: примеры кода нужно самому отправлять в сессию SAS.

Какие задачи решает

  • поставить пакет вроде sasjscore в сессию SAS
  • разобраться, почему %installPackage вернул rc=20006
  • настроить папку пакетов и fileref packages
  • подключить макросы на одну задачу, не трогая SASAUTOS сервера
  • зафиксировать версию пакета при установке

Примеры запросов агенту

  • Помоги поставить пакет sasjscore через SPF и проверить, что макросы живые
  • Установка упала с rc=20006, найди причину и почини
  • Как загрузить макросы на одну сессию и потом выгрузить их обратно?

Как установить sas-packages

1Через Skills CLI (Vercel)

npx skills add sasjs/skills --skill sas-packages -a claude-code

2Вручную: положить файлы

~/.claude/skills/sas-packages/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/sas-packages/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о sas-packages

Как установить sas-packages в Claude Code?

Выполните npx skills add sasjs/skills --skill sas-packages -a claude-code, после чего файл скилла окажется по пути ~/.claude/skills/sas-packages/SKILL.md.

Что делает sas-packages?

Это справочник по SAS Packages Framework: как включить фреймворк, поставить пакет из SASPAC, подключить макросы и выгрузить их. Плюс разбор типичных сбоев установки.

Нужен ли интернет для работы с SPF?

Да, включение фреймворка и %installPackage обращаются к сети из сессии SAS. Если один раз поставить SPFinit в папку пакетов, дальше хватит локального %include.

Исходный текст

SKILL.md · MIT
---
name: sas-packages
description: Installing, loading and unloading SAS packages with the SAS Packages Framework (SPF) and the SASPAC archive - the packages fileref rules, %installPackage / %loadPackage / %helpPackage / %unloadPackage, version pinning. Use when installing a package such as sasjscore, or debugging an install that reports rc=20006 or a missing package zip.
license: MIT
copyright: Copyright (c) SASjs
spdx-license-identifier: MIT
---

# SAS Packages (SPF)

<!-- SPDX-License-Identifier: MIT -->

A **SAS package** is a single zip holding a group of SAS programs (macros, functions, data steps) plus automatically generated description, load, unload and help files. The **SAS Packages Framework** (SPF, by Bartosz Jablonski) installs and loads them from a folder of zips, so a package can be pinned, versioned and swapped without touching `SASAUTOS` or a macro catalogue.

This skill covers using the framework as a consumer. It is not SASjs-specific - SPF is an independent project, and the packages it serves come from any author.

## When to use

- Installing a package into a SAS session, e.g. `sasjscore` (the SASPAC packaging of @sasjs/core)
- Debugging `%installPackage` / `%helpPackage` / `%loadPackage` failures
- Setting up a packages folder, or working out which path to point the `packages` fileref at
- Loading macros for one job without adding them to a shared server's `SASAUTOS`

Don't use for: authoring or publishing a package (`%generatePackage`), or for @sasjs/core's own macro coding standards - see the `sasjs-core` skill for those.

## Enabling the framework

The framework is a single file. Enable it in the session:

```sas
filename packages "%sysfunc(pathname(work))";
filename SPFinit url "https://bit.ly/SPFinit";
%include SPFinit;
```

The raw URL `https://raw.githubusercontent.com/yabwon/SAS_PACKAGES/main/SPF/SPFinit.sas` is the same file without the shortener, and is a better choice where a redirect is unwanted. Enabling the framework needs internet access from the SAS session; it is a one-off per session unless the file is kept on disk (see Persistence below).

## The packages fileref (mandatory)

- The fileref **must** be named `packages`. `packages` and `package` are reserved keywords in SPF; a different name is not picked up.
- It points at a **directory**, not a zip file.
- **The directory must already exist.** SPF does not create it - `%installPackage` is documented as equivalent to manually downloading the zip into that folder, and it will not make the folder for you.

Pick the path by what you need:

| Need | Use |
|---|---|
| Throwaway / portable, works on Windows, Viya and SASjs Server | `filename packages "%sysfunc(pathname(work))";` |
| Survives the session (install once, reuse) | A real directory that exists, e.g. `C:/SAS_PACKAGES` on Windows, or any writable directory on a Linux estate |

`C:/SAS_PACKAGES` appears throughout the SPF documentation, but it is a Windows example. On Linux (Viya, SASjs Server) it is just a relative path, so unless that directory happens to exist the install fails - see Pitfalls.

## Install, load, unload

```sas
%installPackage(sasjscore)  %* download the zip into the packages folder;
%helpPackage(sasjscore)     %* print the package description and contents;
%loadPackage(sasjscore)     %* compile the macros into the session;
%unloadPackage(sasjscore)   %* remove them again;
```

- `%installPackage()` fetches the zip over the network. Default source is the SASPAC archive, `https://github.com/SASPAC/`; override with `sourcePath=` or `mirror=`.
- Package names are space separated and carry **no** `.zip` extension: `%installPackage(pkg1 pkg2)`. Pin a version in parentheses: `%installPackage(baseplus(1.17) macroarray(1.0))`. Add `replace=0` to refuse to overwrite an already-installed package.
- `%installPackage(SPFinit)` installs the framework itself into the packages folder.
- `%loadPackage()` compiles into the session; `%unloadPackage()` deletes those entries from the macro catalogue. A job that needs the macros but whose server should not carry them in `SASAUTOS` can load, use and unload in one session.
- Where the SAS session has no zip fileref support, unzip `<name>.zip` into `<name>.disk` and pass `zip=disk`: `%loadPackage(pkgname,zip=disk,options=)`.

## Persistence: install once, then go offline

Install the framework into the packages folder once:

```sas
%installPackage(SPFinit)
```

After that the two network-facing lines collapse to a local include, and no network access is needed at run time:

```sas
filename packages "/permanent/path/to/packages";
%include packages(SPFinit.sas);
%loadPackage(sasjscore)
```

This requires the fileref to point at a permanent directory - with `%sysfunc(pathname(work))` the framework is gone when the session ends.

## Pitfalls

- **`rc=20006` is a failure, despite reading as success.** `%installPackage` prints `Done with return code rc=20006 (zero = success)` - the parenthetical is just the message template. 20006 means the install failed; the real error is the `ERROR: Physical file does not exist, <dir>/<name>.zip` line that follows. Do not trust the `rc=` line alone.
- **The packages folder must exist before you call `%installPackage`.** This is the most common cause of the failure above, and it bites hardest on Linux because the documented `C:/SAS_PACKAGES` example silently becomes a relative path. Verify with `%put %sysfunc(fileexist(<dir>));` and create it first if it returns 0.
- **A missing zip cascades.** Once the install fails, `%helpPackage` and `%loadPackage` both fail with `File "<dir>/<name>.zip" does not exist!`, and the macros are simply absent - a later call gives `WARNING: Apparent invocation of macro X not resolved`. Fix the install rather than chasing the macro.
- **Installing needs network egress from the SAS session**, not from your workstation. A locked-down compute context without internet cannot reach SASPAC or GitHub.
- **`%loadPackage` is per session.** Macros loaded in one session are not visible in another; re-load in each session (or use `SASAUTOS` / the CLI for durable resolution).

## Verification

After loading, prove the macros are actually live rather than assuming the install worked:

```sas
%put NOTE: package version check;
%helpPackage(sasjscore)          %* prints "Help for package SASjsCore, version X.Y.Z, license MIT";
%put NOTE: getuser returns %mf_getuser();
```

A clean run shows `INFO: Package sasjscore installed.`, the help block with an explicit version, and a resolved macro call. `%unloadPackage()` can then be confirmed by the same call returning `Apparent invocation of macro MF_GETUSER not resolved`.

## Limitations

This skill is a static reference for the SAS Packages Framework. It does not execute SAS code, run shell commands, access the filesystem, or make network requests. Code examples are illustrative and must be submitted to a SAS session by the user. The framework is maintained at https://github.com/yabwon/SAS_PACKAGES and the archive at https://github.com/SASPAC - consult those for the authoritative macro reference and the current framework version.

© sasjs · MIT · sasjs/skills

Похожие скиллы

Все скиллы по теме «Данные и базы» →
xlsx официальный anthropics Работает с табличными файлами: создаёт, читает, правит и преобразует книги. Подходит, когда итогом должен стать файл Excel или другой табличный формат. 187 223установок google-agents-cli-observability официальный Google Помогает настроить трассировку и сбор данных о работе ИИ-агентов, включая агентов на ADK. Пригодится, когда нужно разбирать выполнение запросов или наблюдать за агентом после развёртывания. CX Codex +1 511 300установок caveman-evidence-review JuliusBrussee Скилл читает данные Caveman Cloud о расходах LLM, трассах и маршрутизации. Подходит для проверки того, куда уходит бюджет проекта. CX Codex +1 104 500установок migration JuliusBrussee Скилл задаёт правила безопасных миграций схем, данных и API с обязательным откатом. Пригодится при изменениях, где нельзя терять данные или ломать совместимость. CX Codex +1 103 900установок performance-optimization addyosmani Скилл для агентов ИИ-кодинга: сначала замеряет, потом чинит узкое место — от Core Web Vitals до N+1 запросов и индексов в базе. CX Codex +1 65 200установок supabase официальный supabase Скилл помогает настраивать базу данных, аутентификацию и RLS в Supabase без скрытых дыр в безопасности. CX Codex GP ChatGPT 8установок

Из того же набора6

Спонсоры проекта

Компании, которые помогают держать аналитику открытой