xattr_kit is a package to simplify the management of SAS extended attributes
Purpose: Assign an extended attribute to a variable.
Parameters:
lib - Library name where the dataset resides (default = WORK)
ds - Dataset name
var - Variable name to which the extended attribute will be assigned
xname - Name of the extended attribute
xvalue - Value of the extended attribute
Usage Example:
%xattr_set_var(ds=a, var=x, xname=xa1, xvalue="xxxx");
%xattr_set_var(ds=a, var=x, xname=xa2, xvalue=1111);
%xattr_set_var(ds=a, var=y, xname=ya1, xvalue="yyyy");
Purpose: Assign an extended attribute to a dataset.
Parameters:
lib - Library name where the dataset resides (default = WORK)
ds - Dataset name
xname - Name of the extended attribute
xvalue - Value of the extended attribute
Usage Example:
%xattr_set_ds(ds=a, xname=xds_a1, xvalue="ds attr 1");
Purpose: List of attributes printed and/or logged; results stored in xattrs dataset.
Parameters:
lib - (Optional) Library name to filter the results
ds - (Optional) Dataset name to filter the results
cat - (Optional) Category (VARIABLE or DATASET) to filter
xattr_name - (Optional) Specific extended attribute name to filter
display_ods - (Y/N) Whether to print the result table using PROC PRINT (default = Y)
put_log - (Y/N) Whether to output results to log via PUT statement (default = Y)
Usage Example:
%list_xattr()



Purpose: Reapply extended attributes listed in the xattrs dataset to datasets/variables.
Parameters:
ds - Name of the dataset containing the extended attributes (typically 'xattrs')
Variables required for the read data set are [libname],[ds],[var],[xattr],[xtype],[xvalue]
Usage Example:
%xattr_in(ds=xattrs);


Purpose: Convert extended attribute values into global macro variables.
Parameters:
lib - Library name (default = WORK)
ds - Dataset name
xattr_name - Specific attribute name to extract (optional)
macro_name_type - Naming convention for macro variables. Options:
"libname_ds_var_xattr", "ds_var_xattr", "var_xattr", "xattr"
Default = "ds_var_xattr"
Output: Creates macro variables in the global symbol table with corresponding values.
Usage Example:
%xattr2macrovar(lib=WORK)

0.1.0(22July2025): Initial version
The package is built on top of SAS Packages framework(SPF) developed by Bartosz Jablonski.
For more information about SAS Packages framework, see SAS_PACKAGES.
You can also find more SAS Packages(SASPACs) in SASPAC.
Firstly, create directory for your packages and assign a fileref to it.
filename packages "\path\to\your\packages";
Secondly, enable the SAS Packages Framework.
(If you don't have SAS Packages Framework installed, follow the instruction in SPF documentation to install SAS Packages Framework.)
%include packages(SPFinit.sas)
Install SAS package you want to use using %installPackage() in SPFinit.sas.
%installPackage(packagename, sourcePath=\github\path\for\packagename)
(e.g. %installPackage(ABC, sourcePath=https://github.com/XXXXX/ABC/raw/main/))
Load SAS package you want to use using %loadPackage() in SPFinit.sas.
%loadPackage(packagename)