Documented macro to escape blanks with backslashes under Linux/AIX, although the current implementation does not modi...
View code
ETL
Analysis and Transformation of Automotive Data with CAS
This SAS script configures the CAS environment, loads data from SASHELP to CAS, and then applies various transformati...
View code
Utility
SAS Email Notification
This SAS script defines and uses macros to send email notifications, including the start and end execution times of a...
View code
Statistics, ETL, Reporting
Multiple Data Analysis and Statistics
This SAS script is a collection of examples demonstrating dataset creation via `datalines`, data manipulation (filter...
View code
Data preparation
Data preparation for earthquakes
This SAS script creates a new data table 'work.earthquakes' from the 'sashelp.quakes' table. It adds calculated varia...
View code
Administration
System Environment Management via Macro
Use of the %sysexec command to modify the working directory and environment variables of the underlying system.
View code
Reporting
Automated Generation of Linked HTML Reports with Navigation
This program generates a system of interconnected HTML reports analyzing profits by year and product line.
View code
Reporting
Annual Profit Report by Product Line
This SAS script generates a detailed report of total profit by year, broken down by product line, using the PROC REPO...
View code
Reporting
ODS Report of Profits by Year and Product
Generation of an HTML report analyzing total profits by year and product line with conditional formatting.
View code
Reporting
Profit Report by Product Line and Year
This SAS script generates a detailed annual profit report aggregated by product line, including a percentage of profi...
View code
Mixed
Sales Report and Negative Binomial Simulation
Script combining a sales report (SASHELP.ORSALES) and a statistical data simulation (Negative Binomial Distribution).
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
ETL
DATA Step execution example with end-of-file variable
Script illustrating the use of the END= option in a DATA step to detect the last observation and perform cumulative c...
View code
Date Functions
Calculate the difference in years with INTCK
This SAS script calculates and displays the difference in years between two dates using the INTCK function.
View code
Data Processing
Interval Alignment and Date Functions
Demonstration of alignment options for INTNX and INTCK date/time functions in SAS, illustrating interval calculation ...
View code
ETL
Using the ?? modifier in INPUT
Example of using the ?? modifier to suppress read error messages.
View code
ETL
Export SASHELP.CLASS data to CSV
This SAS script exports the content of the standard SASHELP.CLASS table to a CSV file named class.csv, including colu...
View code
ETL
Exporting Data to CSV
Exports the sashelp.class table to a CSV file.
View code
Utility
Viewing FCMP Function Libraries
This SAS script is used to list and view the contents of an FCMP function library, specifically 'advrpt.functions'.
View code
Utility
Deletion of WORK data
This script deletes all temporary data tables (memtype=data) from the WORK library.
View code
Administration
Checking system options and macro variables
This SAS script checks a system option (`SASAUTOS`) and displays the values of environment or macro variables (`advte...
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
ETL
Manipulating Date and Datetime Formats with ANYDATE
This SAS script demonstrates the use of ANYDATE informats to read and convert different date and datetime formats int...
View code
Reporting
ODS Configuration for Excel XP with Documentation
This SAS script configures the ODS 'tagsets.excelxp' destination to generate Excel files with documentation options.
View code
Reporting
Managing Decimals with PROC FORMAT PICTURE
Demonstration of using PROC FORMAT with the PICTURE statement to format numerical values, specifically managing decim...
View code
ETL
Data Creation and Deduplication with PROC SORT
This SAS script creates an internal dataset, then demonstrates two deduplication methods using PROC SORT: NODUP for c...
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
Général
Sans titre
SAS macro to download Fama-French 3 factors (daily) from an online source and load them into a SAS dataset.
View code
ETL
Downloading FRED Economic Data
SAS macro to download specific economic data from the FRED (Federal Reserve Economic Data) database via a URL.
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
Statistical
Discriminant Analysis of Fisher's (1936) Iris Data
This script performs a quadratic discriminant analysis on Fisher's Iris data, then displays the resulting statistics.
View code
Statistical
Getting Started Example for PROC DISCRIM
Basic demonstration of discriminant analysis using the fish measurement table.
View code
ETL
SDTM DM Dataset Creation
This SAS script configures the environment, generates a Demographics (DM) domain dataset for SDTM using the %dm_creat...
View code
ETL
Creation of Metadata for the DM Table
This SAS script creates a dataset containing metadata (column name, type, length, label) for a 'DM' table, typically ...
View code
Utility
Utility macro to delete a file
This macro allows you to delete a file from the file system if it exists.
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
Statistical
Diet Data Frequency Analysis
This SAS script creates an internal dataset named 'diet' and then performs a cross-frequency analysis between the 'vi...
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
Général
Sans titre
This SAS script offers two main functionalities via macros: analyzing dependencies between SAS macros and verifying t...
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
Derniers codes ajoutés
Boost Performance & Security: Creating Composite Indexes and Passwords with PROC DATASETS
This example illustrates the modification of two SAS data sets using the MODIFY statement and its sub-statements. It shows how to: modify SAS files, label a SAS data set, add a read password to a SAS data set, indicate the current sort order of a SAS data set, create an index for a SAS data set, assign informats and formats to variables, rename variables, and label variables in a SAS data set.
ETL
SAS Data Step Efficiency: When to Use Explicit OUTPUT vs. Implicit Rules
Writes the current observation to a SAS dataset.
Data ManipulationCAS
Stop Struggling with Data Ingestion: Efficiently Move CSVs to Memory with PROC CASUTIL
The CASUTIL procedure offers several table and caslib management functions, including displaying table metadata, deleting files, unloading and loading tables, promoting tables, and saving tables.
ETLCAS
Beyond the WORK Library: Mastering the 4 Default SAS Libraries You Must Know
This document describes the default SAS libraries: Work (temporary), User (user), Sashelp, and Sasuser. It explains their role and behavior within the SAS Viya 4 environment.
Data Access
Seamless Integration: How to Attach Data Step Outputs Directly to SAS Viya Jobs
The SAS Viya Platform File Service allows storing, retrieving, and deleting files kept in the SAS Infrastructure Data Server database repository. This repository is not considered a complete 'file system' but contains individual files directly accessible by their file identifier (UUID).
Administration
From SAS 9 to Viya: The Ultimate Guide to Migrating User-Defined Formats to CAS
In the SAS Viya platform, you can store user-defined formats in catalogs for use in a SAS session, or you can store them in a format library on the CAS server. Format libraries are associated with a CAS session, or they can be promoted to global scope to be available to all CAS sessions. User-defined formats in a format library are server-side formats that the server uses when an analysis is performed based on formatted values. You can migrate existing user-defined formats from SAS to the SAS Viya platform.
ToolsCAS
Instant Performance Boost: Creating Indexes on the Fly with the INDEX= Data Set Option
Defines one or more indexes for a new output SAS data set.
Général
Stop Bloating Your Datasets: The Definitive Guide to Variable Selection with KEEP
Specifies variables to include in output SAS data sets.
ETLCAS
Combine and Conquer: Mixing Physical Paths and Existing Librefs in One LIBNAME Statement
Explains the concept of SAS library concatenation, allowing several libraries to be logically grouped under a single reference (libref).
Data Access
Stop Importing, Start Connecting: A Master Class in SAS/ACCESS Engines and SQL Pass-Through
This document provides examples of using SAS engines to access and process various types of external data, including delimited files, Excel files, databases (DBMS), XML, and JSON.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.