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
Utility
Display the content of the temporary macro catalog
This script uses PROC CATALOG to list the entries (compiled macros) of the temporary 'sasmacr' catalog in the 'WORK' ...
View code
ETL
Data Creation for Proportions Test
This SAS script prepares an internal dataset for subsequent statistical analysis of proportion differences.
View code
Statistical
Chi-Square Test on Survey Data
This SAS script performs a frequency analysis and a Chi-square test on survey data, using custom formats to group var...
View code
Statistical
Test for a Difference Between Proportions (Chi-Square)
This SAS script demonstrates how to test for a significant difference between proportions using the FREQ procedure an...
View code
Statistical
Analysis of the mean difference between two groups
This SAS script simulates a population, draws a random sample from it, and prepares statistical analysis to test the ...
View code
Statistical
Mean Difference Test (T-Test) on Simulated Data
Generation of a random population and performance of a T-test to compare average heights between men and women.
View code
Statistical
Calculation of 95% Confidence Intervals
This script generates a population of 10,000 participants, then draws two random samples of different sizes (10 and 1...
View code
Statistical
Calculation of 95% Confidence Intervals and Sampling Simulation
Educational script demonstrating the calculation of confidence intervals on a simulated population and the effect of ...
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
Utility
Macro lsfp2ds
Creates a SAS dataset from a list of Unix/Linux file names with full paths.
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 / System
Macro ls2sas - Listing Unix Files to SAS
Macro for listing Unix/Linux files matching a specific pattern and storing this list in a SAS table.
View code
Utility
Create a SAS dataset from a list of Unix/Linux files
SAS macro to list Unix/Linux filenames and write them into a SAS dataset.
View code
Reporting
Multirun Log Analysis with gmLogScanReport
Verification of all logs in the current multirun file.
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
Administration
Extracting User IDs from DefaultAuth Domain
This SAS script connects to the SAS metadata server to extract a list of all user IDs defined under the 'DefaultAuth'...
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
Statistical
Survival of Men with Angina Pectoris
This SAS script performs a survival analysis using the life table method to study the survival of men with angina pec...
View code
Statistical
Documentation Example 2 for PROC LIFETEST
This script illustrates the advanced use of the LIFETEST procedure for survival analysis, including managing the disp...
View code
Statistical
Bayesian Survival Analysis with PROC LIFEREG (Example 2)
Fan reliability analysis using a log-normal distribution and Bayesian estimation to predict the probability of failure.
View code
Statistical
Starter Example 1 for PROC LIFEREG
This SAS script is an introductory example of using PROC LIFEREG for survival data analysis. It creates an internal d...
View code
Statistical
Example 6 for PROC LIFEREG
Survival analysis using PROC LIFEREG with a lognormal model and generation of probability plots.
View code
Statistical
Example 5 for PROC LIFEREG
This SAS script illustrates the use of PROC LIFEREG for survival data analysis, including probability plotting for a ...
View code
Statistical
Natural Recovery Time - PROC LIFEREG Example
Survival analysis on natural recovery time data using the Weibull distribution with interval censoring.
View code
Statistical
Example 3 for PROC LIFEREG
This script illustrates the use of the LIFEREG procedure for survival data analysis, showing how to specify different...
View code
Statistical
Tobit Model Example with PROC LIFEREG
This SAS script illustrates the use of the LIFEREG procedure to fit a regression model on censored data (Tobit model)...
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
Général
Sans titre
Macro to list the members of a specified SAS library.
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
ETL
Comparison of variable length definition methods
Demonstration of the impact of character variable initialization on their length and the risk of truncation.
View code
Général
Sans titre
Analysis and forecasting of Southern Hemisphere temperatures from external CSV data, including linear regression, aut...
View code
Reporting
Variable Metadata Report
Generates an HTML report of the metadata (name, type, length, format, informat, label) for all variables in the datas...
View code
Administration
Managing user-defined formats in CAS for Viya
This SAS script demonstrates how to create, save, promote, and make user-defined formats accessible in the SAS Cloud ...
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.