Macro

SAS Macro Library: Scripts, Utilities, and Functions for Automation, Data Management, and Dynamic Reporting

432 Résultats disponibles

Welcome to our comprehensive repository dedicated to SAS© Macro Programming, the essential toolkit for developers and analysts looking to streamline their workflows and industrialize their code.
This category gathers a vast collection of scripts, functions, and utilities designed to solve common technical challenges and automate complex processes. Whether you are working on ETL pipelines, statistical analysis, or application development, you will find ready-to-use solutions for:
String Manipulation & Parsing: Macros to extract words (like LASTWORD), handle delimiters, use Regex, and clean text data efficiently.
System & File Interaction: Utilities to scan directories, manage OS paths, handle file extensions, and interact with external systems (Windows/Unix).
Workflow Automation: Scripts for dynamic variable creation, library auditing (SASAUTOS), and environment initialization.
Data Management & Reporting: Tools for dynamic graph generation, PDF reporting, variable counting, and integrity checks.
Testing & Quality Control: Frameworks for unit testing (SASUnit), assertions, and debugging tools to ensure robust code execution.
Explore these resources to optimize your SAS© environment, reduce code redundancy, and build flexible, high-performance analytical applications.
Macro
SAS Macro Programming: How to Extract the Last Word from Any Delimited String

The LASTWORD macro returns the last word from a delimited list of words. This is useful for some generic forms of BY ...

View code
Macro
Building Interactive SAS Applications: Using %WINDOW and PROC PMENU for Dynamic Data Reporting

Interactive SAS macro that uses a series of windows to allow the user to specify a data set, variables, and options t...

View code
Macro
Auditing the SASAUTOS Library: How to Map and Resolve Macro Autocall Paths

SAS macro to parse the SASAUTOS system option and extract the list of macro search paths.

View code
Macro
Stop Copy-Pasting: A Universal SAS Macro to Automate Repetitive List Operation

Function-style macro that allows editing a list of space-delimited items by applying a modification string to each item.

View code
Macro
Dynamic Graph Generation by Stock

This script uses a SAS macro to dynamically generate a distinct PDF report for each stock present in the SASHELP.STOC...

View code
Macro
Deleting Macros from work.sasmacr Catalog by SQL Pattern

Macro to delete macros from the work.sasmacr catalog using a user-specified SQL search pattern.

View code
Macro
Utility Macro for Truncating a SAS Table

SAS macro that deletes all observations from a table while preserving its structure, indexes, and integrity constraints.

View code
Macro
commaparms - Add commas to macro parameters

Function-style macro to reinsert commas between macro parameters in a character string.

View code
Macro
SAS Macro for Table Version Retrieval (`AHGtabver`)

This macro allows retrieving the version number of a table or component by executing an external system command (`tab...

View code
Macro
Assertion of a Non-Empty Dataset

Generates an event if a specified dataset does not exist or is empty (contains no observations).

View code
Macro
Utility macro to determine the extension of SAS catalogs

Macro that determines the SAS catalog file extension (.sas7bcat, .sc2, etc.) based on a SAS version number provided a...

View code
Macro
Macro _COUNT: Count Elements in a List

A SAS macro that counts and returns the number of individual elements in a list of values.

View code
Macro
Macro to check for dataset existence

This macro, _dsexist, returns 1 (true) if a SAS dataset exists and 0 (false) otherwise. It includes specific handling...

View code
Macro
Macro to display a dataset

SAS Macro that encapsulates the PROC PRINT procedure to display the content of a dataset with formatting options.

View code
Macro
Post-generation analytical graph annotation

Script demonstrating an advanced technique to add custom annotations to a graph generated by an analytical procedure ...

View code
Macro
String Analysis Macro

This SAS macro allows you to split a character string into words or phrases according to specified delimiters, and th...

View code
Macro
Multiple calls to the parsemacro macro

Execution of the %parsemacro macro on a list of components.

View code
Macro
OS Path Variables Management

This macro creates global macro variables to reference operating system directories based on predefined global variab...

View code
Macro
Macro to count numeric variables in a dataset

Function-type macro to return the number of numeric variables in a SAS dataset.

View code
Macro
Managing Numeric Date Conversions with FCMP

This SAS script demonstrates the creation and use of FCMP functions to convert SAS date values into numeric format (Y...

View code
Macro
Macro to Count Variables

SAS Macro to get the number of variables in a specified SAS dataset.

View code
Macro
Macro nvars - Number of Variables

Utility macro returning the number of variables in a given SAS table.

View code
Macro
Macro to get the number of observations

This macro returns the number of observations for a specified SAS dataset.

View code
Macro
SAS Macro for Comma Removal

Functional macro to replace commas with spaces in a character string.

View code
Macro
Macro `now` for timestamp

Function-style macro to return the current timestamp.

View code
Macro
Utility Macro _version and String Management

Script containing macro utilities for SAS version management and string handling.

View code
Macro
NEXT Graphic Configuration Macro

Macro defining global graphic options for the 'nxtcolor' device.

View code
Macro
NEXTLPR Printing Macro

Defines a macro to configure the SAS graphical environment for printing via the 'lpr' system command.

View code
Macro
mv_jobflow macro test for task orchestration

This SAS script is a comprehensive test case for the `mv_jobflow` macro, a task orchestration tool. It demonstrates d...

View code
Macro
Macro Variable Existence Check with Scope

Checks the existence of a SAS macro variable, optionally limiting the search to a specific scope.

View code
Macro
Cross-Platform Code Retrieval Macro

Generic macro to retrieve SAS code (Viya jobs, SAS 9 stored processes, or SASjs programs) based on the detected execu...

View code
Macro
Macro mcrTwo Call

Invoking macro %mcrTwo with a specific parameter.

View code
Macro
Hello World with Macro Variable

Introductory script displaying a personalized message in the SAS log.

View code
Macro
SAS Viya Job Code Retrieval Test

Unit test script validating the creation of a SAS Job and the retrieval of its source code using utility macros.

View code
Macro
Macro makehash - Hash Object Initialization

In-datastep utility macro to quickly initialize and configure a SAS Hash object.

View code
Macro
Macro Maxlengths - Calculation of String Lengths

Utility macro to determine the actual maximum data length contained in character variables of a SAS table.

View code
Macro
Company Name Resolution Macro

Macro displaying the full name of a company based on its abbreviation.

View code
Macro
WHEROBS Macro - Filtered Observation Count

SAS macro to count the number of observations in a table by applying an optional WHERE filter.

View code
Macro
Dynamic Recursive Execution of SAS Files

Macro to include and execute all SAS programs located in a directory and its subdirectories.

View code
Macro
Directory Inspection using SAS Macro Functions

Macro script to list and count files in a given directory.

View code
Macro
Listvar Macro: Extracting and Sorting Variable Metadata

Utility macro to list SAS table variables and create an output table containing their metadata sorted by position.

View code
Macro
Autocall Macros Configuration and Testing

Script illustrating the definition of local macros, modifying the macro search path (sasautos), and calling macros.

View code
Macro
Using the IN operator and MINDELIMITER in SAS macros

Example of using the IN operator in a macro with a custom delimiter.

View code
Macro
Macro hasvarsc - Checking for presence of character variables

Macro function that returns true (1) if a dataset contains all character variables specified in a given list.

View code
Macro
Macro-Variable Manipulation and Arithmetic Operations

Example of using the %LET and %PUT macro statements to define variables and display results.

View code
Macro
Dynamic HTML Report Generation via Macros

Set of macros to dynamically generate an HTML page containing links to SAS libraries and system files.

View code
Macro
Dynamic Creation of Vertical Macro Variables

Practical exercise to create a vertical list of macro variables during a Data Step execution.

View code
Macro
Using Macro Variable Lists for Dynamic Programs

Dynamically creating macro variables from SASHELP.CLASS dataset and displaying them in the SAS log.

View code
Macro
CSV Export Macro (ex_csv)

Utility macro to export a SAS table to a CSV file via PROC EXPORT.

View code
Macro
Exercise: Dynamic Creation of Macro Variables with PROC SQL

Training exercise aimed at creating a horizontal list of values in a macro variable using PROC SQL's INTO syntax.

View code
Macro
Dynamic creation of horizontal macro variable list

Script generating a list of values separated by a tilde (~) into a macro variable from a SAS table.

View code
Macro
Macro dirfp2sas: Listing Windows files to SAS table

Utility macro to list full file paths matching a given pattern into a SAS table.

View code
Macro
Macro appmvar - Conditional Concatenation of Macro Variables

Function-style macro to append a string to an existing macro variable.

View code
Macro
Expected Error Assertion (FUTS Framework)

FUTS test framework utility macro checking if an expected error occurred during execution.

View code
Macro
Differential Snapshot of WORK Datasets

Utility macro to identify newly created SAS tables in the WORK library between two steps.

View code
Macro
Macro for Retrieving Table Names

Macro generating a list of all datasets present in a given SAS library via a global macro variable.

View code
Macro
AHGlibpath Macro - Retrieving the Physical Path of a Library

Utility macro to retrieve the system path associated with a given SAS libref.

View code
Macro
AHG Utility Macros for String Manipulation

Definition of three utility macros (AHGstartwith, AHGtestANDcut, AHGmask) for string manipulation and verification. T...

View code
Macro
Left-Right Justified Alignment Macro

Utility macro for aligning text left and right over a defined width.

View code
Macro
SAS Macro for Left Justification of Text

This SAS macro, named `_lj`, is designed to left-justify text based on the specified line size, handling up to 10 tex...

View code
Macro
Macro _NULL: Determining the System's Null Device

This macro provides the null device path (_NULL) adapted to the current operating system (Unix or Windows), allowing ...

View code
Macro
Dataset Option Extraction Macro

Utility macro to isolate and return the 'options' part of a SAS dataset name provided as a string.

View code
Macro
_pdfjam Macro for Merging PDF Files

This SAS macro uses the external utility 'pdfjam' to merge a main PDF file with a series of sequentially numbered PDF...

View code
Macro
Using the Macro Facility to Generate CAS DATA Step Code

This article explains how to use the SAS macro facility to dynamically generate SAS DATA Step code that interacts wit...

View code
Macro
String Reversal Macro and Variable Tests

SAS script defining a macro to reverse a character string and performing simple tests to display macro variables.

View code
Macro
Comparison of IF vs. WHERE filtering in a macro

Script generating test data and executing a macro to repeatedly compare two filtering methods (IF vs WHERE).

View code
Macro
GET Function (Expression Engine Language)

The GET function returns the element at a specified index within an Expression Engine Language (EEL) dynamic array.

View code
Macro
Extracting PROC FREQ statistics via text file

SAS macro extracting a specific statistic from PROC FREQ results by redirecting output to a text file and then parsin...

View code
Macro
Creating and Testing a SAS Web Service for Object Sending

This SAS script uses macros to create and test a web service named 'sendObj'. The service is designed to return SAS t...

View code
Macro
Test of the ms_getusers macro

Unit test script for the ms_getusers macro, validating user extraction and variable scope management.

View code
Macro
Test of the ms_deletefile macro

Unit test script to validate the functionality of the ms_deletefile macro.

View code
Macro
Macro mp_wait4file - Wait for file availability

Utility macro suspending program execution until a target file appears or a timeout expires.

View code
Macro
Recursive Directory Scan

SAS macro that recursively scans a directory tree to list all subfolders and files.

View code
Macro
SAS library write speed test macro

This macro evaluates write speed by creating a temporary dataset of a specified size in a SAS library, then measuring...

View code
Macro
Workload Generation for Performance Testing

Macro executing a series of SAS processes (Data Step, SQL, Sort, Summary) for a determined duration to simulate syste...

View code
Macro
Key-Value Manager in a Dataset

This SAS macro, `%mp_setkeyvalue`, allows storing and managing key-value pairs in a specified SAS dataset. It creates...

View code
Macro
Macro mp_perflog - Performance Logging

Utility macro to record performance checkpoints (message, job ID, timestamp) in a SAS table.

View code
Macro
Generating an MD5 hash expression

SAS macro to generate an MD5 hash expression for a set of character and numeric variables, intended for use in a DATA...

View code
Macro
Table Locking Mechanism Test via Macros

This script is a test program for a SAS table locking macro system. It verifies the creation of a control table, tabl...

View code
Macro
Generating DDL for a SAS table

Wrapper macro to generate the DDL (Data Definition Language) for a specific SAS table, allowing the specification of ...

View code
Macro
Test of the mp_ds2cards and mp_assert macros

This SAS script tests the functionality of the `mp_ds2cards` macro, which converts a SAS dataset into `DATALINES/CARD...

View code
Macro
SAS Macro mp_dropmembers

Macro to delete SAS tables and views without generating warnings in the log. Useful for conditional deletion or multi...

View code
Macro
Extraction of Formatted Distinct Values

This macro extracts formatted distinct values of a specific variable from a SAS dataset.

View code
Macro
Macro to create SQL dictionary views

This macro dynamically creates views in a specified SAS library (default WORK) for all entries in SAS SQL dictionary ...

View code
Macro
Managing Core SASjs Tables (mp_coretable)

Centralized management macro for defining permanent tables (DDL) of the sasjs/core library.

View code
Macro
Test of the `dostuff` macro with `mp_assertscope`

This script tests a macro named `dostuff` that manipulates global macro variables. It uses the test macros `mp_assert...

View code
Macro
Binary File Concatenation

Macro to concatenate the content of multiple files in binary mode.

View code
Macro
Get the last modification date of a dataset

Function-type macro that returns the date and time of the last modification of a SAS dataset, with a formatting option.

View code
Macro
Retrieve Metadata Objects (mm_getobjects)

Macro to retrieve a list of objects of a specific type from the SAS metadata server (SAS 9 legacy).

View code
Macro
Recursive directory creation macro

SAS macro to recursively create directories on the operating system.

View code
Macro
Macro %mixcase for mixed case text formatting

SAS macro to convert a character string to mixed case, capitalizing the first letter of each word and handling specia...

View code
Macro
Annotation Macro for Missing Data

This macro generates an annotation dataset to visualize observations with missing values for X or Y variables in a sc...

View code
Macro
Min_Member_Length Macro

This macro takes a delimited list and returns the minimum length of any member in that list.

View code
Macro
Checking for SASHDAT file existence in CAS

Macro checking if a .sashdat format table exists in a specified CAS library.

View code
Macro
Macro for writing a text file

This macro allows creating or appending content to a text file using only SAS macro functions. It can write up to 10 ...

View code
Macro
Macro for extracting unique words between two strings

This SAS macro compares two space-separated character strings and returns the words present in the first string (`Str...

View code
Macro
Extract common words from two strings

SAS macro to identify and return common words from two space-separated character strings.

View code
Macro
Macro Variable Verification (mf_verifymacvars)

Checks if a set of macro variables exist and contain non-empty values.

View code
Macro
Removing Trailing Characters from String

SAS macro to remove a specific trailing string from another string if present.

View code
Macro
Getting the format of a SAS variable

SAS macro that returns the format of a specified variable from a SAS dataset (table or view). It can also assign a de...

View code
Macro
Test of the mf_getvarcount macro

Unit test script verifying variable counting in a SAS table via the mf_getvarcount macro.

View code
Macro
Unique Fileref Generation

SAS macro that assigns and returns an unused temporary fileref, circumventing issues with native fileref recognition ...

View code
Macro
Extract SAS Format Name

Macro to extract the base name of a SAS format, ignoring its length and decimals.

View code
Macro
Get the SAS library engine type

This macro returns the engine type of a specified SAS library.

View code
Macro
Dynamic determination of an application's root location

SAS macro to dynamically identify the root path (appLoc) of a SASjs application in the SAS logical folder tree.

View code
Macro
DateTime Format Selection (mf_fmtdttm)

Macro determining the optimal date/time format (E8601DT26.6 or DATETIME19.3) based on the SAS environment version to ...

View code
Macro
mf_existfunction Macro

Checks the existence of a specific SAS function.

View code
Macro
Checking for variable existence in a dataset (mf_existvarlist)

This macro checks if all variables specified in 'varlist' exist in a given SAS dataset referenced by 'libds'. It retu...

View code
Macro
String Deduplication

Macro to remove duplicates from a string based on a specified delimiter.

View code
Macro
Detecting Maximum Indices of Titles and Footnotes

Utility macro to identify the highest numbers used for titles and footnotes in the current SAS session.

View code
Macro
Loading Macro Library from GitHub

Initialization script that dynamically downloads and compiles a suite of SAS macros from a public GitHub repository.

View code
Macro
Macro Marvel Messages

SAS macro displaying superhero quotes in the log.

View code
Macro
Markcode Macro - Interactive Execution and Visualization (Legacy)

Utility macro designed for classic interactive SAS environments (Display Manager) to submit buffer code and open the ...

View code
Macro
Macro markdsn - Interactive table opening

Utility macro designed to open a SAS table (dataset) whose name is stored in the system clipboard. Uses interactive c...

View code
Macro
Creating and Assigning a Temporary Library

This macro checks for the existence of the 'c:\tempwork' directory and creates it if necessary on a Windows system, t...

View code
Macro
SDTM Date Creation --DTC

This SAS macro generates an SDTM-formatted date variable (--DTC) from date and time components provided as separate S...

View code
Macro
Macro Variable Manipulation and Data Creation

This SAS script demonstrates the creation of an internal dataset and the use of various macro functions to manipulate...

View code
Macro
Path Test Macro

Analysis and demonstration of using the %SYSFUNC(DEQUOTE) macro to handle character strings with or without quotes.

View code
Macro
Print and Frequency Test Macro

This SAS script defines a global macro variable and a macro to display version information and execute a simple frequ...

View code
Macro
Deletion of compiled macros

Utility macro to delete compiled macros from the current session (WORK library).

View code
Macro
Sans titre

Provides a %mabbrev macro-function that mimics REXX's 'abbrev' function, allowing to check if one string is a valid a...

View code
Macro
Generic Utility Macro m_utl_xxx

Utility macro for a generic function. Provides a brief and detailed description of the macro's function.

View code
Macro
m_val_xxx Validation Macro Skeleton

Basic structure for a validation macro with integrated Doxygen documentation.

View code
Macro
m_uc_xxx Macro Definition Template

This file is a standardized template for creating SAS macros, including a detailed documentation structure.

View code
Macro
Logging Macro m_log_xxx

SAS macro skeleton for logging, containing only the definition structure and documentation.

View code
Macro
Generic header macro m_hdr_xxx

Standardized header macro for SAS scripts, facilitating documentation and parameter management such as help and debug...

View code
Macro
Macro template m_cst_xxx

Definition skeleton for a custom SAS macro, including standardized header documentation.

View code
Macro
Interactive Input via Macro Window (Legacy)

Defines and attempts to display a textual interactive window for parameter input.

View code
Macro
SAS CALC Macro for Descriptive Analysis

This SAS macro, named CALC, validates variables in a specified dataset and executes the PROC MEANS procedure on valid...

View code
Macro
SAS Variable Name Cleaning and Normalization

This SAS script illustrates three implementations of a '%fixname' macro, whose objective is to clean and normalize ch...

View code
Macro
Simple Conditional Macro

This SAS script defines and uses a simple macro that takes a parameter and displays a corresponding company name base...

View code
Macro
Company Name Display Macro

This SAS macro displays the full name of a company based on an abbreviation provided as a parameter in the SAS log.

View code
Macro
Company Greeting Macro

This macro displays a company name or a generic phrase in the SAS log based on the provided argument.

View code
Macro
Secure extraction of the first character of a macro variable with %SUPERQ

Demonstrates the importance of the %SUPERQ macro function for manipulating strings containing special characters in t...

View code
Macro
Conditional State WHERE Macro

Defines and executes a SAS macro that determines a geographic region (Southeast, Northwest, Unknown) based on a US st...

View code
Macro
Defining and calling the where macro

Definition of a simple macro using conditional logic to display a geographical region in the log based on a state code.

View code
Macro
Handling special characters in macros

Example of using the quoting functions %STR and %NRSTR.

View code
Macro
Managing space delimiter in %QSCAN

Illustration of using the %str function to define a space as a delimiter in the %qscan macro function.

View code
Macro
Name Processing Macro

This script defines and uses a SAS macro to reorder a full name (format 'Last Name, First Name') into 'First Name Las...

View code
Macro
Name Reordering Macro

SAS macro to reorder a full name (Last Name, First Name) to First Name Last Name.

View code
Macro
String manipulation macro

This SAS macro takes a full name (in 'Last Name, First Name' format) as input, reverses the order to display 'First N...

View code
Macro
Name extraction and reformatting

This script defines and calls a SAS macro to extract the first name and last name from a 'Last Name, First Name' form...

View code
Macro
String Manipulation with %SCAN Macro

This SAS script defines and executes a macro that manipulates a full name string (format 'Last Name, First Name') to ...

View code
Macro
Name Reorganization Macro

This SAS script defines a macro to reorganize a full name provided as 'Last Name, First Name' into 'First Name Last N...

View code
Macro
Macro Deletion with %SYSMACDELETE

Illustration of deleting a macro definition and subsequent call attempt.

View code
Macro
Analysis of the SAS Macro Catalog

This SAS script examines system options related to macro storage and lists the contents of a specific macro catalog f...

View code
Macro
lsfp2sas Macro - Listing Unix/Linux files into SAS

Utility macro for listing Unix/Linux files matching a specific pattern and storing this list in a SAS table.

View code
Macro
List files with full path (Unix)

Function-type macro that returns the list of files in a directory on a Unix system, with their full path and enclosed...

View code
Macro
lscmd Macro - List files in a Unix directory

Function-style macro returning the list of members in a Unix directory via the 'ls -1' command.

View code
Macro
Ljustify Macro

SAS macro to left-justify all character variables in a dataset.

View code
Macro
SAS Macro Testing and Management

This script demonstrates the use of the %listmacro macro to inspect and manage SAS macros, integrating assertions to ...

View code
Macro
SAS File Listing Macro

This script contains a SAS macro to list files in a given directory, including its subdirectories, with an option to ...

View code
Macro
list2format Macro

Creates a SAS numeric format based on a list of values provided as a parameter.

View code
Macro
Test of the _mkDir macro-program

This script is a SASUnit unit test for the _mkDir macro-program, which is used to create directories on the file system.

View code
Macro
Macro _MIN: Find the Minimum

SAS macro that determines the minimum between two expressions, similar to the MIN() function of the DATA STEP, by han...

View code
Macro
Macro _MAX for Maximum

This macro implements a function similar to the DATA STEP's MAX() function, returning the maximum of two arguments or...

View code
Macro
Macro _LS for LINESIZE

Utility macro to retrieve the value of the SAS system option 'LINESIZE'.

View code
Macro
Macro _LIB for extracting library name

This macro extracts the SAS library name from a full data set reference, or returns 'work' by default if none is spec...

View code
Macro
Utility Macros for Data Analysis and SAS Metadata Manipulation

This script provides a set of three SAS macros. The 'DissGraphMakerLogOdds' macro performs in-depth data analysis, in...

View code
Macro
Example of Data Creation and Conditional Macro

This SAS script illustrates the internal creation of datasets via DATA STEP and the definition/call of a macro includ...

View code
Macro
Log Formatting and Time Tracking Macro

Utility macro to generate clean and framed log messages, including execution time calculation and timeout alerts.

View code
Macro
Creating a left-aligned title

SAS macro to generate a left-aligned report title.

View code
Macro
Lafootnote Macro

Creates a left-aligned footnote in SAS outputs.

View code
Macro
Macro Variable Management

This SAS script illustrates the declaration, assignment, and display of macro variables.

View code
Macro
Functional macro for ISO 8601 format

This functional macro generates a character string in ISO 8601 format (YYYY-MM-DDTHH:MM:SS) from two numeric SAS vari...

View code
Macro
Definition of ISO formats for date and time

This SAS macro defines custom formats for dates and times according to the ISO 8601 standard, specifically handling t...

View code
Macro
Macro addvar - Text variable splitting

SAS macro designed to manage and split text variables exceeding a specified maximum length (default 200 characters).

View code
Macro
Macro jjqcclean - Cleaning the working environment

Utility macro to clear the WORK library and reset the DOMAIN variable.

View code
Macro
Generation of a Delimited List of Numbers

Macro to create a delimited list of integers.

View code
Macro
SAS Name Validity Check

Functional macro to check if a character string is a valid SAS name according to naming rules.

View code
Macro
Extract ISO 8601 Date Part

Function-style macro to extract the date part from an ISO 8601 standard datetime text value.

View code
Macro
Creating macro variables with leading zeros via PROC SQL

Script generating a series of numbered macro variables (name01 to name19) from the data in the SASHELP.CLASS table.

View code
Macro
Issue a Warning Message via Log4SAS

Utility macro to send a warning message to a specified Log4SAS logger.

View code
Macro
Utility Macro _LAST

Generates a logical expression to identify the last observation of a BY group or the last global observation of a dat...

View code
Macro
Issuing fatal message via log4sas

SAS macro to issue a FATAL level message to a specified log4sas logger.

View code
Macro
LOG4SAS Information Message Emission Macro

This SAS macro emits an informational message to a specified LOG4SAS logger, including parameter validity checks.

View code
Macro
Macro to issue a trace message

This SAS macro issues a trace message to a specific logger using the `log4sas_logevent` function of the SASUnit frame...

View code
Macro
Issues an error message in an 'assert' to a logger

Issues an error message within an assertion to a logger.

View code
Macro
Assertion Log4SAS information message

Emits an assertion information message to a logger.

View code
Macro
Warning Macro for SASUnit Assertion

This internal SASUnit macro emits a warning message via a logger, specifically during an assertion within the log4sas...

View code
Macro
SAS Macro Definition and Verification

This script illustrates the definition of a simple SAS macro and the verification of its registration in the temporar...

View code
Macro
Using %EVAL and %SYSEVALF Functions

Demonstrates the use of the %EVAL and %SYSEVALF macro functions to perform arithmetic calculations on macro variables...

View code
Macro
Using the %INDEX macro function

This SAS script illustrates the use of the %INDEX macro function to search for a substring within a string, and highl...

View code
Macro
Using the %SYSEVALF Macro Function

This SAS script demonstrates the use of the %SYSEVALF macro function to evaluate arithmetic and logical expressions, ...

View code
Macro
Definition of the Prtlast macro

This script defines a utility macro named %prtlast that displays data from the most recently created table in the SAS...

View code
Macro
Using the IFC macro function for OS detection

Example of using the `ifc` function via `%sysfunc` to execute immediate conditional logic in the macro language.

View code
Macro
Macro Import - Dependency Management

Fundamental utility macro for intelligent import and dependency management of SAS macro files.

View code
Macro
Graphic Resizing Macro

SAS macro to resize graphic parameters (size and position) while maintaining the aspect ratio of the cells.

View code
Macro
Variable verification in a dataset

This function-type macro returns '1' if a dataset contains all variables specified in a user-provided list, and '0' o...

View code
Macro
Search and Navigation Method for VIEWTABLE

This method, designed for use within a VIEWTABLE class (SAS/AF), intercepts commands to search for values in columns ...

View code
Macro
Greenbar style macro for ODS

This macro implements a 'greenbar' effect (alternating colored rows) to improve the readability of reports generated ...

View code
Macro
Verification of global macro variable existence

Function-style macro that returns 'true' (1) if all specified global macro variables exist in the SAS environment.

View code
Macro
List of Global Macro Variables

This function-style macro returns a list of the names of current SAS global macro variables.

View code
Macro
Extracting and Managing ODS Styles

This SAS script extracts the list of available ODS styles, exports them to Excel, then re-imports them to generate in...

View code
Macro
GHI macro definition

Definition of a simple macro displaying a message in the log to verify autocall.

View code
Macro
Git Repository Installation and Loading Macros

Two macros to clone a Git/GitHub repository and automatically load the contained SAS macros.

View code
Macro
SAS Code Inclusion Macro from GitHub

This SAS macro allows the inclusion and execution of SAS code files stored in a specified GitHub repository, thereby ...

View code
Macro
Delete entries from a graphics catalog

The GKILL macro deletes entries from a graphics catalog. This is useful when PROC GREPLAY is used repeatedly in a sin...

View code
Macro
Retrieving Autocall Paths (SASAUTOS)

Utility macro to extract the autocall path configuration (SASAUTOS).

View code
Macro
Utility Macros and SAS Version Check

This SAS script bundles the definition of several macros: a wrapper macro for group management, a SAS version check m...

View code
Macro
Getpath Macro - File Inclusion Manager

Utility macro for dynamic file path resolution and conditional inclusion.

View code
Macro
File Extension Extraction Macro

Utility macro returning the extension of a file from its path.

View code
Macro
Extracting the Base Path of a File

Utility macro to extract the path of a file without its name or extension.

View code
Macro
Extract file name without extension

Utility macro to extract a file's name without its extension from a full path.

View code
Macro
Macro to list dataset variables

This SAS macro provides a fast and purely macro-based method to get a list of variable names from a specified dataset...

View code
Macro
Macro _INDEXC

This macro implements a functionality similar to the DATASTEP INDEXC function, searching for the first occurrence of ...

View code
Macro
Macro _INDEXW: Word Search in a String

SAS Macro encapsulating the DATASTEP INDEXW() function to find the position of a word within a character string.

View code
Macro
Get File Extension

Gets the extension of a given filename, including the separator dot.

View code
Macro
Macro _getPgmDesc - Documentation Extraction

SASUnit utility macro designed to extract the short description of a SAS program from Doxygen (brief) tags present in...

View code
Macro
Utility Macro _IFELSE

Utility macro implementing ternary conditional logic (If-Then-Else).

View code
Macro
Extract variable metadata and export to Excel

This SAS macro extracts detailed variable metadata (name, type, length, format) for one or more datasets specified in...

View code
Macro
Macro GetProgramName - Retrieving Program Path

Utility macro returning the full path and name of the currently executing SAS program.

View code
Macro
Data Creation and Retrieval of Observation Count

Script creating a test dataset and storing its observation count in a macro variable.

View code
Macro
SAS Unit Test Template

Code skeleton for writing unit tests.

View code
Macro
SQL Logical Condition Generator

Utility macro to generate a string of logical conditions (WHERE clause) from lists of columns and values.

View code
Macro
GenFmt Macro: Dynamic Format Generation (Legacy)

Old macro generating a SAS format from a data table by writing the format code to an external file.

View code
Macro
Dynamic column width calculation for export

Utility script analyzing metadata and content of the SASHELP.CLASS table to determine maximum variable and data lengt...

View code
Macro
Aligned Text Formatting Macro

Utility macro to build a line of text with elements aligned to the left, center, and right.

View code
Macro
FORMCHAR Macro for Formatting Character Management

SAS Macro to configure the FORMCHAR system option, allowing selection between standard characters or line drawing cha...

View code
Macro
Begin and End of Month Functions (BeginMonth, EndMonth)

This SAS script defines two custom FCMP functions, BeginMonth and EndMonth, to determine the first and last day of th...

View code
Macro
fixlen Macro: Numeric String Length Adjustment

Macro to adjust a character string (representing a number) to a fixed length for display purposes.

View code
Macro
Documentation Generation via Code Diary

Configuration and execution script for the `%code_diary` macro to automatically generate technical documentation from...

View code
Macro
Retrieving the format search path (fmtsearch)

Function macro that returns the complete and normalized list of format catalogs defined in the fmtsearch option.

View code
Macro
Utility macro for managing the FMTSEARCH option

Checks for the presence of a library in the FMTSEARCH option and adds it if specified.

View code
Macro
FILEREF Existence Check

This macro checks if a SAS fileref has been assigned and if the associated external file exists, returning a numeric ...

View code
Macro
FIND_WORD Utility Macro

Macro function returning the ordinal position (nth word) of a specific word in a sentence.

View code
Macro
Macro for calling the FIND method of a hash object

This SAS macro, designed for use within a DATA STEP, encapsulates the call to the FIND method of a hash object. It fa...

View code
Macro
Factorial Calculation with PROC FCMP

Script defining and using custom functions for factorial calculation via PROC FCMP.

View code
Macro
SAS Macro for Capturing and Displaying a Log Section

This SAS macro allows capturing a specific section of the SAS log (from a specified marker to the end of the log), sa...

View code
Macro
Conditional Code Deactivation via Macro Variables

Technique for dynamically activating or deactivating a SAS code block using macro variables to generate comment tags.

View code
Macro
Interaction Expansion Macro (Bar Operator)

Set of macros simulating the bar operator '|' used in statistical procedures to automatically generate main effects a...

View code
Macro
GLM Formula Expansion Macros

Set of SAS macros to expand linear model specifications (vertical bar notation) into a full list of terms and interac...

View code
Macro
Unit test of the _getAbsPathComponents macro

Unit test script for the _getAbsPathComponents macro, validating the extraction of the filename and parent path from ...

View code
Macro
Search for program in autocall libraries

Searches for a specific program file in autocall libraries and returns the identifier of the library where it was found.

View code
Macro
Test of the _getAutocallNumber macro

Unit test script for the _getAutocallNumber macro verifying the resolution of macro search paths (autocall).

View code
Macro
Searching for .html/.htm endings with regular expressions

This SAS script uses regular expression (PRX) functions to detect if character strings end with '.html' or '.htm'. It...

View code
Macro
SAS _FILE Macro to remove quotes

This SAS script defines a `%_file` macro that takes a character string as an argument and removes single or double qu...

View code
Macro
Macro _FINFO - Extended File Information

Utility macro to retrieve detailed file information (date, permissions, size) via a system command.

View code
Macro
Utility Macro _FIRST

Generates a SAS logical expression to identify the first observation of a BY group or the first general observation i...

View code
Macro
File Variable Initialization (_FN)

Macro determining the name and path of the currently executing SAS program to initialize global output variables.

View code
Macro
Test of the _executeCmdFile macro

Unit test script for the SASUnit _executeCmdFile macro.

View code
Macro
Macro _EXIST - File Existence Check

Simple SAS macro to check for the existence of a file or directory on the file system.

View code
Macro
Directory Existence Check

SAS macro to check if a given directory exists and is accessible.

View code
Macro
Checks for the existence of a variable in a dataset

Macro-function that checks if a variable, with an optional type, exists in a SAS dataset.

View code
Macro
Simple Inclusion Macro

This script defines a simple SAS macro that displays a message in the log when called.

View code
Macro
OS Command File Execution

Executes an operating system command file via a SAS macro.

View code
Macro
SAS Macro for the Number of Observations in a Table

This utility macro returns the number of observations in a SAS dataset specified by its identifier (DSID).

View code
Macro
Using SAS Macro Variable Lists to Create Dynamic Data-Driven Programs

This SAS script is designed to extract student names from the SASHELP.CLASS dataset, concatenate them into a tilde-se...

View code
Macro
Dynamic data segmentation via vertical macro variables

Script using a macro to dynamically divide the SASHELP.CARS table into several sub-tables based on the unique values ...

View code
Macro
Creating a list of macro variables with PROC SQL

Exercise showing how to dynamically create a horizontal list of macro variables with PROC SQL.

View code
Macro
Using SAS Macro Variable Lists to Create Dynamic Data-Driven Programs

Creates a simple macro variable at runtime using the SQL procedure to extract the weight of a specific vehicle.

View code
Macro
Dynamic Macro-Variable Creation with PROC SQL

Exercise to create a macro-variable at runtime using the PROC SQL INTO clause.

View code
Macro
Using SAS macro variable lists to create dynamic data-driven programs

Creating a macro variable at runtime from the DATA step.

View code
Macro
Dynamic creation of macro variables via Data Step (Exercise 01)

Practical exercise aimed at creating a macro variable at runtime using a Data Step.

View code
Macro
ETL Verification and Process Abort

Utility macro to check system return codes (SYSCC) and SQL return codes (SQLRC) and abort the SAS process in case of ...

View code
Macro
equals.sas

Function-style macro for DATA STEP to compare two numerical values and determine if they are equal or very close.

View code
Macro
Macro %EQUESUFF to suffix a list of words with an equal sign

This function-style macro adds an equal sign to the end of each element in a list of words or variables, primarily to...

View code
Macro
Wrapper for Windows 7 environment variables extraction

Macro wrapper to save Windows 7 environment variables into a SAS table.

View code
Macro
Macro to ensure a string ends with a specific character

Function-style macro that ensures a non-null value assigned to a macro variable ends with a specified character.

View code
Macro
env2sas

Macro to write system and user environment variables to a SAS table.

View code
Macro
Remote Submission End Macro

Utility macro to end a remote submission and close the session if a connection is defined.

View code
Macro
Macro to draw an ellipse

This SAS macro generates the coordinates for drawing an ellipse, taking into account the center, axis lengths, tilt, ...

View code
Macro
Macro eanend - Enhanced Analysis Shutdown

Utility macro used to terminate an analysis or debugging session (probably initiated by a corresponding 'eanbegin' ma...

View code
Macro
Macro %Dups for duplicate management

Utility macro to identify duplicates and isolate unique records in a SAS table.

View code
Macro
Generate a date scale for SAS/GRAPH

SAS macro to generate the start, end and step values for a date scale intended for SAS/GRAPH, based on a minimum, max...

View code
Macro
Macro _escapeblanks (Escaping blanks)

Documented macro to escape blanks with backslashes under Linux/AIX, although the current implementation does not modi...

View code
Macro
Automated Data Comparison Macro

Defines and uses an '%autocompare' macro to compare two datasets, identify differences, and present them in a readabl...

View code
Macro
Trace the location of an autocall macro

This script configures autocall macro libraries in SAS and demonstrates the use of a built-in macro (%obscnt) to coun...

View code
Macro
Dynamic creation of macro variables using SYMPUTX

This script illustrates the use of the CALL SYMPUTX routine to create macro variables whose names are dynamically det...

View code
Macro
dsall.sas - Dataset List Expansion

Utility macro to expand the _ALL_ notation in a dataset list into all datasets present in the specified SAS libraries...

View code
Macro
dsc_echofile_tolog Macro

Utility macro to display the content of external files (via filerefs) directly in the SAS log.

View code
Macro
Wrapper Macro for DOSUBL

A utility macro for executing SAS code via the DOSUBL function.

View code
Macro
Dquote Macro: Adding Double Quotes

Utility macro to enclose a character string in double quotes while protecting special characters.

View code
Macro
Macro dropmodifiers

Utility macro to use in a Data Step to remove modifiers (dataset options) from a variable containing table names.

View code
Macro
Dropvars Macro

Utility macro to delete a list of unwanted variables from one or more SAS datasets.

View code
Macro
Directory Existence Check

SAS macro to check if a specified path corresponds to an existing directory.

View code
Macro
dirfp2ds

Lists full path (Windows) filenames into a SAS dataset.

View code
Macro
Macro dirfpq - List of files with full path (Windows)

Macro returning a list of files from a Windows directory with their full paths, based on a specified pattern.

View code
Macro
Count the number of observations in a dataset

SAS macro-function to determine the number of observations in a specified dataset.

View code
Macro
List files from a directory into a SAS dataset

SAS macro to list file names from a specified directory (via a pattern) into a SAS dataset.

View code
Macro
List Directory Content

Function-type macro that returns the list of members in a directory on a WINDOWS platform.

View code
Macro
String Dequoting

Function-style macro to remove matching quotes at the beginning and end of a macro string and return the result.

View code
Macro
Error Return Code Management

SAS macro to capture and propagate the highest error code encountered during the execution of an ETL process or similar.

View code
Macro
Macro deleteSasmacN - Cleaning numbered SASMAC catalogs

Macro deleting all numbered 'sasmacr#' catalogs in the WORK library, without deleting the main 'sasmacr' catalog.

View code
Macro
Delete entries from a graphics catalog

This macro deletes specific entries or all entries from a SAS graphics catalog.

View code
Macro
Macro Variable Existence Check (Defined)

Macro checking if a macro variable is defined in the global environment.

View code
Macro
Macro variable existence check (defined)

Macro function that determines if a specific macro variable is defined in the global environment.

View code
Macro
Macro _DIRCHAR for directory character

This macro returns the appropriate directory separator character for the operating system.

View code
Macro
DROPMISS Macro - Deleting Empty Variables

SAS macro to delete variables from a table that contain no data (only missing values).

View code
Macro
Deletion of Temporary Datasets

Utility macro to delete specific temporary datasets (starting with 'DATA') from the WORK library.

View code
Macro
DeBlackHole Debug Macro

Utility macro designed to reset the SAS interpreter in case of persistent syntax errors (open quotes, unclosed commen...

View code
Macro
DBMSlist Macro - Batch Database Querying

SAS macro designed to query a relational database using values from a SAS dataset as filtering criteria, processed in...

View code
Macro
SAS Table Existence Assertion Macro

Utility macro used in unit tests to verify the existence (or non-existence) of a given SAS table and raise an asserti...

View code
Macro
Temporary File Name Generation

Macro to create a unique temporary file name in a specific folder.

View code
Macro
Dynamic CSV export macro csv_vnext

Utility macro to export a SAS dataset to a delimited file (CSV) using a DATA _NULL_ step and the CALL VNEXT routine t...

View code
Macro
SAS Macro for Centered Title with Form Feed

This SAS macro creates a centered page title and adds a form feed character at the far right (FFx).

View code
Macro
Numeric variable categorization macro (cut)

This SAS macro categorizes a numeric variable into user-defined classes (bins). It creates a new variable containing ...

View code
Macro
Space Cleaning Command Macro

Command-type macro to replace multiple spaces with single spaces.

View code
Macro
Test Macro for Cross-Referencing

Test macro designed to demonstrate and validate the cross-referencing functionality of macro calls within the SASUnit...

View code
Macro
Cross-reference Test Macro

This SAS macro, named 'CrossReferenceTest2', is a component of the SASUnit test framework. It creates a temporary dat...

View code
Macro
Test macro for cross-referencing

Simple test macro to demonstrate cross-referencing and numerical parameter evaluation.

View code
Macro
Creation of EXA Test Data Table

Macro to create the EXA test database table for the SASUnit framework.

View code
Macro
TSU Test Data Table Creation Macro

SAS macro to create a test data table named 'tsu' in a specified library. This table is used to store test parameters...

View code
Macro
Pre-processing macro for a unit test

This macro prepares the environment for test execution. It cleans up previous test artifacts, inventories existing ma...

View code
Macro
Creation of the test database

Creates a test database for the SASUnit framework.

View code
Macro
Creation of the SASUnit test case table

Macro creating the 'cas' table intended to store test case metadata and results within the SASUnit framework.

View code
Macro
Code Diary Documentation Generation

Script for configuring and executing the generation of technical documentation from SAS code.

View code
Macro
String List Formatting Utility (CQUOTE)

Converts a space-separated list of values into a comma-separated quoted list.

View code
Macro
List Conversion and Formatting Macro

This utility macro converts a list of elements (provided as a delimited string) into a new formatted list. It offers ...

View code
Macro
Macro %compress for string management

This SAS macro encapsulates the COMPRESS function to remove specified characters from a text string, with error handl...

View code
Macro
Colnames Macro: List Variables (R-style)

Utility macro simulating R's colnames() function to list variables of a SAS table located in the WORK library.

View code
Macro
Macro to replace the last comma with ' and '

This macro replaces the last occurrence of the sequence ', ' (comma-space) with ' and ' in a given character string, ...

View code
Macro
Global Test Execution

This script initializes the environment via autoexec and launches all tests defined by the %test macro.

View code
Macro
Macro assertTrue - Check if a condition is true

SASUNIT Macro to evaluate a condition and assert that it is true, handling numeric and character types.

View code
Macro
cmd2sas Macro

SAS macro to execute a local system command and write its output to a data set.

View code
Macro
Macro Management and Exploration via SAS Catalog

This SAS script defines, stores, copies, and lists macros contained within a SAS macro catalog.

View code
Macro
Simple Macro Definition and Call

This SAS script defines a simple macro named 'test' that creates an empty dataset 'test'. The macro is then called. I...

View code
Macro
Numeric String Alignment Macro

SAS macro to vertically align character variables representing numbers based on separators (dot, comma, parenthesis).

View code
Macro
Variable Reordering / Selection Macro

Main SAS macro (`%chn_dt_ordvar`) designed to reorder a dataset by placing a specified set of variables at the beginn...

View code
Macro
Token Counting Macro

This SAS macro counts the number of tokens (words) in a given string, using a specified delimiter.

View code
Macro
Execution and Reporting Pilot Script (Chapter 8)

Orchestrator script that cleans the environment, loads a series of external SAS programs, and defines a reporting macro.

View code
Macro
Autocall Library Verification

Simple macro to verify the proper functioning of the autocall library by writing a message to the log window.

View code
Macro
Macros for Canonical Naming and Versioning Management

Script defining utility macros for normalizing names via handlers and checking SAS version.

View code
Macro
Case Replacement Macro

Function-style macro to force the case of a specific substring within a source string.

View code
Macro
CAT Macro: Concatenation of Variable Values

This SAS macro concatenates the values of a list of variables into a single output variable, using a specified separa...

View code
Macro
Macro for dynamic macro re-execution with dataset parameters

This macro allows repeated execution of another macro by passing parameters dynamically read from a dataset. It overc...

View code
Macro
Documentation Automation with Code Diary

Configuration and execution script to generate SAS project documentation in Markdown and HTML format.

View code
Macro
Graphic Shape Drawing Macros (Brackets, Arcs, Lines)

This SAS script defines three utility macros (%bracket, %arcpie, %line) to facilitate the drawing of basic graphic sh...

View code
Macro
Test macro with log display

Defines a simple macro that writes the value of its parameter to the SAS log and configures log display options.

View code
Macro
Remove the last BY title and store it in a macro variable

Macro to remove the last title if it's a title generated by a 'BY' clause and store its content in the global macro v...

View code
Macro
Deletion of macro variables and macros

Macro for deleting macro variables (potentially macro variable arrays) and, optionally, compiled macros from the WORK...

View code
Macro
Macro boxanno - Scatter plot annotation with box plots

Set of macros (boxaxis and boxanno) to create annotation datasets for adding univariate box plots to the axes of a sc...

View code
Macro
Creation of Base Datasets

This SAS script defines a `%basedatasets` macro that creates three temporary datasets (Customer, Contracts, CustomerC...

View code
Macro
Retrieve a numeric attribute from a dataset

Macro-function to retrieve the value of a numeric attribute from a SAS dataset (e.g., number of observations or creat...

View code
Macro
Retrieve a numeric attribute from a dataset

Macro-function to retrieve a numeric attribute from a SAS dataset, such as the number of observations (NOBS) or the m...

View code
Macro
Macro assert_not_exist - Table non-existence assertion

Test macro generating an event if a specified SAS table exists.

View code
Macro
Macro assert_not_fileexist - Assertion for file absence

Generates an event if a specified file exists, used to validate that a file should not be present.

View code
Macro
Macro assert_not_null - Non-Nullity Assertion

Test utility macro generating an event if the specified argument is null or has zero length.

View code
Macro
Macro assert_not_zero - Non-nullity Assertion

Generates an event (error/alert) if the argument value is equal to zero.

View code
Macro
Macro assert_null - Non-null value assertion

Test macro checking if an argument is not null and generating an event accordingly.

View code
Macro
Macro assert_zero - Null Value Assertion

Unit test macro checking if a given value is equal to zero and generating an event in case of failure.

View code
Macro
assertManual Macro

SAS Macro for handling manual assertions in the SASUnit testing framework.

View code
Macro
Macro assert_exist - Table existence verification

Unit test macro verifying the existence of a SAS table and generating an event in case of failure.

View code
Macro
Sans titre

Unit test macro verifying the presence of a physical file and generating an event if it is absent.

View code
Macro
Substring Extraction After Target Character

SAS functional macro to extract the part of a string located after the first occurrence of a target character.

View code
Macro
Allocation Macro for Read-Only Libraries (allocr)

Example macro to allocate data and format libraries in read-only mode for a specific clinical study (Spectre Clinical).

View code
Macro
AHGwt Macro - Writing to a file

Utility macro to write a specific character string to a text file.

View code
Macro
AHGzero Macro for Numeric Formatting

This macro formats a given number into a character string of a specified length, using the %SYSFUNC(PUTN()) function.

View code
Macro
Formatting Macro for Clipboard

SAS Macro to read clipboard content, format it, and save it to a text file for Microsoft Word.

View code
Macro
Decimal Point Alignment Macro (aligndp.sas)

This SAS macro, designed for use in a DATA step, formats a numeric variable into a character variable by aligning dec...

View code
Macro
Macro allafter

This function-style macro returns the part of a character string that follows the first occurrence of a given target ...

View code
Macro
AHGwhere Utility Macro

Macro systematically returning the value 1, likely acting as an 'always true' condition.

View code
Macro
Operating System Detection (Windows/Unix)

Utility macro to determine if the SAS execution environment is Windows or Unix.

View code
Macro
Windows Temporary Path Macro

Macro defining a Windows-specific temporary directory path.

View code
Macro
Word Relationship Management

This SAS macro manages word relationships by storing and deduplicating them in a SAS table 'allstd.wordtowords'.

View code
Macro
AHGuncompress Macro - Character Retention

Utility macro that allows retaining only specified characters in a text string, acting as a positive filter.

View code
Macro
AHGuseLabel Macro - Variable Renaming by Label

This SAS macro allows renaming variables in a dataset using their label as the basis for the new variable name. It in...

View code
Macro
User Path Definition Macro

Defines a macro that returns a network path specific to the current user.

View code
Macro
AHGsome Utility Macro

Defines a utility macro called AHGsome, which checks if a given character string is not empty using the internal macr...

View code
Macro
AHGsubsetdsn In-place Filtering Macro

SAS macro to filter an existing dataset, replacing it with a subset based on a globally provided condition.

View code
Macro
String Normalization Macro AHGtabnoStr

Utility macro to replace dots and spaces with underscores in a character string.

View code
Macro
AHGtag Macro

Utility macro for generating simple HTML or XML tags.

View code
Macro
AHGscanxy Macro for Substring Extraction

This utility macro extracts a specific element from a character string using coordinate-based (x, y) scanning logic.

View code
Macro
AHGsetprint Macro: Merging and Formatting SAS Tables

Macro for combining (stacking) multiple SAS tables while standardizing variables to character format for easier displ...

View code
Macro
Definition of the AHGshortpath macro

Definition of a SAS macro named AHGshortpath. Currently empty.

View code
Macro
Macro AHGRTFtotxt - RTF Conversion and Parsing

Utility macro designed to convert an RTF file into a flat text file or a SAS dataset. It cleans RTF formatting tags a...

View code
Macro
RTF to Text File Conversion

SAS macro to convert an RTF file to a plain text file by cleaning up formatting tags.

View code
Macro
Macro to configure Autocall macro paths

SAS macro that dynamically configures the SASAUTOS system option to define autocall macro search paths based on the e...

View code
Macro
Definition of the AHGsavecommandline macro

Definition of an empty SAS macro with parameters.

View code
Macro
AHGsavedsn Macro - Table backup with suffix

Macro for duplicating a SAS table by adding a suffix to the output table name.

View code
Macro
Nested String Parsing Macro

Utility macro for extracting substrings from a string with nested delimiters.

View code
Macro
Random String Generation

This SAS macro generates a random string of uppercase letters (from A to X) of a specified length. It can be used to ...

View code
Macro
AHGprocMeansBy Macro - Statistics by segments

Utility macro to calculate statistics on data segments (defined by a 'by' variable) and consolidate the results.

View code
Macro
PROC PRINT Macro for Printing

This macro simplifies the use of PROC PRINT for printing datasets.

View code
Macro
AHGPtoL Display Macro

Simple macro displaying the content of a parameter in the SAS log.

View code
Macro
SAS Pure Table Name Extraction (AHGpureName Macro)

Utility macro to extract the root name of a SAS table, ignoring dataset options (such as WHERE or KEEP/DROP filters i...

View code
Macro
ahgputc Macro: INPUT Conversion with Default Format

Utility macro applying the INPUT function to a variable with automatic default format management.

View code
Macro
Format application macro and left alignment

Utility macro to format a variable and left-align the result.

View code
Macro
Macro _begin for IN: operator

SAS _begin macro that generates a list of items for the IN: operator, designed to replace the %_in macro and handle c...

View code
Macro
Macro _BIN: Generating IN Operators

Utility macro designed to generate lists of values for the IN() operator in a more robust way than %_IN().

View code
Macro
Analysis of the _BY macro

This SAS macro, named _BY, is designed to dynamically manipulate the list of variables used in a BY statement. It int...

View code
Macro
Change Directory (OS-independent)

SAS macro to change the current directory in an OS-independent manner (Unix/Windows).

View code
Macro
Runtime Environment Verification (_checkRunEnvironment)

Validation macro checking if the operating system and SAS version are supported.

View code
Macro
Counting Subjects by Treatment Group

This SAS program generates the count of unique subjects per treatment group from an adsl dataset, using dummy treatme...

View code
Macro
Extracting the first element of a string with %SCAN

This SAS script demonstrates the use of the %SCAN macro function to extract the first element of a comma-delimited st...

View code
Macro
get_append_base Macro for Structure Generation

Macro displaying in the log the SAS code to recreate the structure (formats) of a given table.

View code
Macro
Data Preparation for EM5BATCH

This SAS script prepares the 'workspace' and 'actions' datasets, which are used as input parameters for the '%em5batc...

View code
Macro
Macro AHGNum2date - Numeric Date Formatting

Utility macro to convert a SAS numeric value (representing a date) into a formatted character string.

View code
Macro
Windows Operating System Check

This macro checks if the operating system is Windows.

View code
Macro
AHGopenby Macro - Automated File Opening

Utility macro for searching and opening (or listing) files matching a specific mask in predefined folders based on th...

View code
Macro
AHGppt Utility Macro

Utility macro to assign a string and generate output in a DATA step.

View code
Macro
SAS Table Merge Macro (AHGmergedsn)

Utility macro to merge two SAS tables with automatic sorting and join type management (Left, Right, Full, Matched).

View code
Macro
AHGnonblank Macro - Non-empty String Check

Utility macro returning the logical inverse of the %AHGblank macro.

View code
Macro
Server Detection Macro

Checks for the presence of the string 'sddsrv' in the server's hostname.

View code
Macro
AHGLIKE Macro for Word Filtering

This macro allows filtering words from a character string by comparing each word (after removing digits) to a given w...

View code
Macro
Macro AHGlinebyline: Vertical display of words

Utility macro displaying each word from a provided list of parameters on a distinct line in the log.

View code
Macro
Macro for local macro variable creation

Definition of a utility macro to create a local macro variable whose name and value are passed as parameters.

View code
Macro
Macro AHGlocf - LOCF Imputation

SAS macro designed to implement a 'Last Observation Carried Forward' (LOCF) logic by generating an additional observa...

View code
Macro
AHGkill Macro for Deleting SAS Datasets

SAS macro to delete one or more specified datasets from a SAS library. It can target specific datasets or all dataset...

View code
Macro
AHGlibname Macro - Libref Extraction

Utility macro to extract the library name (libref) from a SAS table name.

View code
Macro
Font size configuration macro

Defines a macro to adjust font size and other display options.

View code
Macro
AHGforceFormat Macro - Forced variable formatting

Utility macro to modify the length and format of specific variables in a SAS table based on definitions stored in ext...

View code
Macro
Macro to get the number of observations in a table

This macro retrieves the number of observations (nobs) of a SAS table specified by its library and table name paramet...

View code
Macro
Definition of macro AHGgetTempVname

Definition of an empty SAS macro named AHGgetTempVname. It currently performs no operations.

View code
Macro
Macro AHGfilesindir - Listing files in a directory

Utility macro to list files in a specific directory and store the result in a macro variable.

View code
Macro
AHGeqV Macro (text comparison)

This macro is a wrapper that calls the `%AHGequaltext` macro to compare two text strings provided as parameters.

View code
Macro
Macro AHGeqm

Wrapper macro to call the AHGequalmactext macro.

View code
Macro
Case-insensitive text comparison macro

Utility macro comparing two character strings without considering case.

View code
Macro
Case-insensitive text comparison

Macro comparing two character strings without considering case.

View code
Macro
AHGdefault Utility Macro

Defines a utility macro to assign a default value to a specified macro variable if it is currently empty, with an opt...

View code
Macro
Macro AHGdim - Dimension Calculation

Utility macro calculating a dimension rounded up to the nearest integer, based on a count of elements divided by a fa...

View code
Macro
Comparison of Versioned Files AHGcmpWithSys

This SAS macro allows the comparison of two versions of a specified file, potentially managed by a version control sy...

View code
Macro
ahgD Delimiter Utility Macro

Macro conditionally inserting a delimiter.

View code
Macro
Getting the current date and time

Utility macro to get the current system date and time and store them in a specified SAS macro variable.

View code
Macro
Indirect macro variable resolution

Utility macro allowing indirect resolution of a macro variable.

View code
Macro
ahgarr List Element Extraction Macro

Utility macro to extract a specific element from a list stored in a macro variable.

View code
Macro
AHGbareName Macro

Utility macro to extract the 'bare name' of a dataset or file.

View code
Macro
Extracting the Base Name of a Dataset

Utility macro to extract the base name of a dataset, whether or not it is prefixed by a library.

View code
Macro
AHGblank Macro

Macro to check if a character string is empty or contains only spaces.

View code
Macro
Conditional addition of trailing slash

Utility macro to add a directory delimiter to the end of a path if necessary.

View code
Macro
Macro to add entry to CDARS system metadata

SAS macro to add a unique entry (identified by 'tot') to a metadata file (`reports.meta`), integrating version contro...

View code
Macro
AHGaddvars Macro: Adding and Formatting Variables

Utility macro to apply formats to a list of variables in a SAS table, creating these variables if they do not exist.

View code
Macro
Macro to add words after deletion

This utility macro combines deleting words from a phrase with adding new words to the end, using an internal macro %A...

View code
Macro
Age calculation from dates

This SAS macro calculates a person's age in full years based on their date of birth and a reference date. It takes in...

View code
Macro
Date Management with FCMP Functions

This SAS script defines and uses FCMP functions to manipulate dates by adding or subtracting months and years.

View code
Macro
Add a path to SASAUTOS

Concatenates a macro library to the sasautos path.

View code
Macro
Conditional Utility Macro ahg0

Macro that returns a specific character string if an input parameter is empty.

View code
Macro
Conditional Execution Utility Macro

Macro executing a SAS statement if a specified parameter is not empty.

View code
Macro
Forced termination of SAS program (_ABEND)

This SAS script defines an _ABEND macro that allows a SAS program to be stopped depending on the execution environmen...

View code
Macro
Documentation Generation and HTML Conversion

Script configuring and executing the code_diary macro to generate project documentation, followed by conversion to HTML.

View code
Macro
Test program for _getpgmdesc

Test program for the _getpgmdesc functionality using 'brief' documentation tags.

View code
Macro
Utility macro library for table management and interface

Script defining utility macros to delete, copy, and inspect SAS tables, as well as an interface command for the old d...

View code