SAS Viya Data Sets

Ready-to-use scripts for your CAS testing

Access a comprehensive library of Data Step codes to test and validate your CAS actions.

158 Scripts available

Creating and Saving a Sample Action Set
Action: actionSetFromTable

First, we need to define a simple action set and then save it to a CAS table. This table will then be used ...

DATA STEP View Code
Defining a Custom Action Set
Action: actionSetToTable

Before converting an action set to a table, one must first be defined. This code snippet creates a simple, ...

DATA STEP View Code
Data Creation for Examples
Action: addCaslib

No specific data creation is needed for the addCaslib action itself, as it is used to define a data source ...

DATA STEP View Code
Setting Up a Path-Based Caslib
Action: addCaslibSubdir

Before creating a subdirectory, we first need a caslib. This code sets up a new caslib named 'myCaslib' poi...

DATA STEP View Code
Creating a Control Data Set for a Format Library
Action: addFmtLib

Before adding a format library to CAS, you first need to create one. A common method is to use PROC FORMAT ...

DATA STEP View Code
Data Creation
Action: addFormat

First, we create a format library named 'myFmtLib' to store our custom formats. Then, we load a simple data...

DATA STEP View Code
Data Creation
Action: addLayer

This action does not directly use training data. It operates on a model definition table. However, to build...

DATA STEP View Code
Context: No Data Creation Required
Action: addNode

The `addNode` action is an administrative function used to manage the CAS server infrastructure. It does no...

DATA STEP View Code
Prerequisites
Action: addNodeStatus

This action does not require any specific data to be created beforehand. It is a server monitoring action.

DATA STEP View Code
No Data Creation
Action: addPrototypes

The `addPrototypes` action does not create a standard dataset. Instead, it populates a special CAS table wi...

DATA STEP View Code
Data Creation
Action: addRoutines

This action does not directly use input data, but it creates a CAS table containing the compiled functions....

DATA STEP View Code
Data Creation (Client-Side)
Action: addTable

The `addTable` action is used by client-side utilities to upload data. For example, in Python, you would ty...

DATA STEP View Code
Data Creation for Examples
Action: addUserActionSetPath

The following code creates a local directory and a caslib named 'mycaslib' that points to this directory. T...

DATA STEP View Code
Creating the 'cars' dataset
Action: aggregate

The following code creates a sample CAS table named 'cars' which contains information about various car mod...

DATA STEP View Code
Data Creation for alJoin Examples
Action: alJoin

This code snippet creates two sample tables: 'raw_data' containing the main dataset with features, and 'ann...

DATA STEP View Code
Data Creation
Action: alterTable

This code creates a sample table 'CARS_DATA' in the 'casuser' caslib, which will be used in the following e...

DATA STEP View Code
Creating a Sample Dataset with Missing Values
Action: analyzeMissingPatterns

This SAS code creates a sample dataset named 'sample_data_missing' in the 'casuser' caslib. The dataset inc...

DATA STEP View Code
Create Sample Data for Training
Action: annCode

This example creates a sample dataset named 'sample_data' with several input variables and a target variabl...

DATA STEP View Code
Creating an Image Table with Annotations
Action: annotateImages

This example demonstrates how to load images from a specified path into a CAS table and prepare it for anno...

DATA STEP View Code
Data Creation for Scoring
Action: annScore

This example first creates a sample dataset `mycas.iris_score` which has the same structure as the training...

DATA STEP View Code
Data Creation
Action: annTrain

This example uses the `HMEQ` dataset from the `SAMPSIO` library, which contains information about home equi...

DATA STEP View Code
Data Creation
Action: append

The following code creates two tables, `target_table` and `source_table`, in the active caslib. `target_tab...

DATA STEP View Code
Data Creation for Categorization
Action: applyCategory

This SAS code creates two tables: 'reviews' which contains the text data to be categorized, and 'category_m...

DATA STEP View Code
Data Creation
Action: applyConcept

This example creates a sample CAS table named 'my_documents' with two columns: 'doc_id' for the document id...

DATA STEP View Code
Data Creation for ARIMA Analysis
Action: arima

This example creates a sample time series dataset named 'series' with a date and a value 'y'. This data wil...

DATA STEP View Code
Data Creation
Action: assess

This example uses the `HMEQ` dataset, which contains information about home equity loans. We will first loa...

DATA STEP View Code
Data Creation for Bias Assessment
Action: assessBias

This example first loads the `HMEQ` dataset, which contains home equity loan data. Then, a gradient boostin...

DATA STEP View Code
No Data Creation Needed
Action: assumeRole

The `assumeRole` action does not directly interact with or create data tables. It is an administrative acti...

DATA STEP View Code
Data Creation
Action: attribute

This code creates a simple in-memory table named 'CARS' in the 'CASUSER' caslib. This table will be used in...

DATA STEP View Code
Loading Images into a CAS Table
Action: augmentImages

Before augmenting images, they must be loaded into a CAS table. The following code uses `proc casutil` to l...

DATA STEP View Code
Data Creation
Action: bartGauss

This example creates a sample dataset named 'sample_data'. The target variable 'y' is generated from a comb...

DATA STEP View Code
Data Creation
Action: bartProbit

This example creates a sample dataset named 'purchase_data'. The dataset simulates customer purchasing beha...

DATA STEP View Code
Data Creation for Scoring
Action: bartScore

This example first creates a training dataset 'mycas.train_data' and a scoring dataset 'mycas.score_data'. ...

DATA STEP View Code
Data Creation
Action: bartScoreMargin

This example first creates a sample dataset 'getStarted' with a binary outcome 'y' and several predictor va...

DATA STEP View Code
Data Creation for Examples
Action: batchresults

This step is not directly required for the `batchresults` action itself, as it operates on sessions and act...

DATA STEP View Code
Data Creation
Action: biconnectedComponents

This example uses a simple undirected graph to illustrate the biconnected components algorithm. The graph c...

DATA STEP View Code
Data Creation
Action: binning

This example creates a sample dataset `sample_data` in the active caslib. The table contains customer infor...

DATA STEP View Code
Data Creation
Action: bnet

This example creates a simple dataset named 'golf' with weather conditions and a decision on whether to pla...

DATA STEP View Code
Data Creation
Action: boxChart

This example creates a CAS table named `mycas.PistonRings`. This table contains diameter measurements of pi...

DATA STEP View Code
Data Creation
Action: boxPlot

This example creates the 'wines' table in your default caslib. This table contains information about differ...

DATA STEP View Code
Data Creation
Action: brScore

This example first creates two CAS tables. The `rule_terms` table defines two Boolean rules. Rule 1 is 'ter...

DATA STEP View Code
Data Creation: Document-Term and Document-Category Data
Action: brTrain

First, we create two tables. 'doc_term_data' contains the sparse representation of documents, linking docum...

DATA STEP View Code
Data Creation: Loading DICOM Medical Images
Action: buildSurface

Before building a surface, we first need to load 3D medical image data. This example uses the `loadDicomDat...

DATA STEP View Code
Data Creation: Table of Significant Terms
Action: buildTermIndex

This SAS code creates a sample CAS table named 'significant_terms' in the 'casuser' caslib. This table simu...

DATA STEP View Code
Data Creation for Causal Analysis
Action: caEffect

This example creates a dataset named 'treatment_data'. It contains an outcome variable 'outcome', a treatme...

DATA STEP View Code
Creating Reference and Hypothesis Data
Action: calculateErrorRate

First, we create two CAS tables. `reference_transcripts` holds the correct, or 'ground truth', text. `hypot...

DATA STEP View Code
Data Setup
Action: caslibInfo

This code sets up two caslibs, 'myCaslib' and 'salesCas', which can be used in the examples. 'myCaslib' poi...

DATA STEP View Code
Data Creation
Action: catTrans

This example creates a sample dataset `customer_data` with a categorical variable `product_category` and a ...

DATA STEP View Code
Data Creation: Circuit Board Defects
Action: cChart

This SAS code creates a sample dataset named 'Circuits'. Each record represents a batch of circuit boards i...

DATA STEP View Code
Data Creation for Simulation
Action: cdm

The cdm action requires pre-existing CAS tables for severity and count model definitions or estimates. The ...

DATA STEP View Code
Creating the Input Data
Action: centrality

This example creates a simple social network graph to demonstrate how to calculate centrality metrics. The ...

DATA STEP View Code
Loading an ONNX Model into a CAS Table
Action: check

To use the `check` action, the ONNX model must first be available in CAS as a binary large object. The foll...

DATA STEP View Code
Data Creation: Checking Out an Object
Action: checkInAllObjects

To demonstrate `checkInAllObjects`, we first need an object to be in a 'checked-out' state. This code loads...

DATA STEP View Code
Data Setup for Examples
Action: checkOutObject

This code sets up a caslib and a table required for the examples. It also creates an access control to demo...

DATA STEP View Code
Data Creation: Friendship Network
Action: clique

This dataset represents a friendship network where each link indicates a friendship between two people.

DATA STEP View Code
Data Creation
Action: community

This example uses the `mycas.LinkSetIn` data table to represent the links of a graph. The `from` and `to` c...

DATA STEP View Code
Data Creation
Action: compare

This example creates two tables, `sales_q1` and `sales_q2`, to represent sales data for two different quart...

DATA STEP View Code
Data Creation: Loading Source and Reference Images
Action: compareImages

This example demonstrates how to load two sets of images (source and reference) from server paths into two ...

DATA STEP View Code
Creating the Input Rule Table
Action: compileCategory

This example creates a CAS table named 'category_rules_table'. This table contains the category rules that ...

DATA STEP View Code
Creating the Input Concept Rules Table
Action: compileConcept

To use the `compileConcept` action, you first need a CAS table containing your concept rules. This table mu...

DATA STEP View Code
Data Creation: Loading Audio Files
Action: computeFeatures

First, we load audio files into a CAS table. The `loadAudio` action scans a directory for audio files and l...

DATA STEP View Code
Data Creation
Action: condenseImages

This example first creates a synthetic dataset named 'pixel_data'. This table simulates a flattened image f...

DATA STEP View Code
Creating the Input Data
Action: connectedComponents

This example creates a simple undirected graph with two separate components. The first component includes n...

DATA STEP View Code
Creating the Input Data Table
Action: convertMps

This example creates a simple two-column CAS table named `mps_free`. The first column, `id`, is a row ident...

DATA STEP View Code
Data Creation
Action: copulaFit

This example requires a dataset with multiple continuous variables to model their dependence structure. We ...

DATA STEP View Code
Data Creation: Sample Correlation and Data Tables
Action: copulaSimulate

First, we create two CAS tables. 'mycorr' holds a Pearson correlation matrix for a 2-dimensional Normal cop...

DATA STEP View Code
Data Creation for Model Fitting
Action: copulaViewStore

Before using copulaViewStore, you first need to fit a copula model and save it to an item store using the '...

DATA STEP View Code
Creating and Saving a Decision Tree Model
Action: copyModelExternal

To use `copyModelExternal`, a model must first exist in a CAS table. This code trains a simple decision tre...

DATA STEP View Code
Data Creation: Sample Source Table
Action: copyTable

This code creates a simple in-memory table named 'source_data' in the 'casuser' caslib. This table will ser...

DATA STEP View Code
Data Creation
Action: core

This example creates a simple undirected graph to illustrate the core decomposition. The graph has 9 nodes ...

DATA STEP View Code
Create the 'cars' Data Set
Action: correlation

This example uses the 'cars' data set from the 'sashelp' library, which is commonly available in SAS enviro...

DATA STEP View Code
Creating Sample Data for Count Regression
Action: countregFitModel

This SAS code generates a sample dataset named 'd_counts' in the 'mycas' caslib. The dataset contains a cou...

DATA STEP View Code
Creating the `science_articles` Dataset
Action: countregViewStore

This dataset simulates data about scientists. The goal is to model the number of articles published (`artic...

DATA STEP View Code
Data Creation: Bone Marrow Transplant Data
Action: cox

This example uses data from a study on bone marrow transplants for leukemia patients. The data, stored in t...

DATA STEP View Code
Setting Up Sample Data and Access Controls
Action: createBackup

Before backing up access controls, we first need some data and controls to exist. The following code sets u...

DATA STEP View Code
Data Creation: Sample Text Data and Model Tables
Action: crfScore

This example first creates a sample input table 'score_data' with document IDs and text. Then, it simulates...

DATA STEP View Code
Data Creation
Action: crfTrain

This example creates a sample dataset named 'my_cas_library.sequence_data'. This table contains sequences o...

DATA STEP View Code
Data Creation
Action: crossTab

The following code creates the 'cars' table in the 'casuser' caslib, which will be used in the examples. Th...

DATA STEP View Code
Data Creation
Action: cspade

This example creates a sample dataset of customer transactions over time. Each row represents an item purch...

DATA STEP View Code
Graph Data Creation
Action: cycle

Creates a dataset defining a directed graph with two potential cycles: A-B-C-A (total weight 6) and A-D-C-A...

DATA STEP View Code
Data Creation for ECM
Action: ecm

Creates a simulated copula table (uniform distributions) and two marginal loss tables (Log-Normal and Gamma...

DATA STEP View Code
Data Preparation
Action: eig

Loads the sample 'Iris' dataset into a CAS table named 'iris' in the 'casuser' library.

DATA STEP View Code
Session Initialization
Action: endSession

Establish a CAS session to be subsequently terminated.

DATA STEP View Code
Create Sample Time Series Data
Action: esm

Generates a synthetic dataset containing monthly sales data with a trend and seasonality, then loads it int...

DATA STEP View Code
Session Setup
Action: eventingInfo

Ensure a CAS session is active before running the action.

DATA STEP View Code
Creation of test data for EWMA analysis
Action: ewmaChart

Generates a dataset 'metalclips' containing gap measurements for metal clips produced over several days, to...

DATA STEP View Code
Create Sample Data
Action: execDirect

Generate a sample CAS table named 'Cars' for the SQL examples.

DATA STEP View Code
CAS Session Setup
Action: executeProgram

Establish a connection to the CAS server.

DATA STEP View Code
Creation of Time Series Data
Action: expectedRange

Generates a sample time series dataset with a date variable and a value variable to be used for range analy...

DATA STEP View Code
Create Sample Data
Action: exploreCorrelation

Generates a sample dataset with correlated interval and nominal variables for analysis.

DATA STEP View Code
Load Sample Data
Action: exploreData

Load the SASHelp 'Cars' dataset into the active CAS session for analysis.

DATA STEP View Code
Data Setup
Action: exportTextModel

Ensure the textRuleDevelop action set is loaded and you have a compiled model table (e.g., 'concept_model_t...

DATA STEP View Code
Data Setup for Extraction
Action: extract

Load a sample ONNX analytic store table into CAS for demonstration purposes.

DATA STEP View Code
Load Data
Action: extractDetectedObjects

Load images containing object detection data into a CAS table.

DATA STEP View Code
Creation of sparse rating data
Action: factmac

Creates a dataset 'ratings' simulating user-item interactions often used in recommendation systems.

DATA STEP View Code
Create Sample Data for Factor Analysis
Action: faExtract

Creates a dataset 'socio_economics' containing socio-economic indicators for analysis.

DATA STEP View Code
Create Data for Factor Analysis
Action: faNFactors

Creates a sample dataset 'analysisData' in the 'mycas' library with simulated numeric variables.

DATA STEP View Code
Create Mixed Signal Data
Action: fastIca

Create a dataset in CAS containing two mixed signals generated from a sine wave and a sawtooth wave.

DATA STEP View Code
Create Input and Query Data
Action: fastknn

Create two datasets: one serving as the reference data and one as the query data.

DATA STEP View Code
Load Data
Action: featureMachine

Load the HMEQ dataset for use in the examples.

DATA STEP View Code
Data Creation
Action: fetch

Load the SASHELP.CARS dataset into the CASUSER caslib for demonstration.

DATA STEP View Code
Load Image Data
Action: fetchImages

Before fetching, images must be loaded into a CAS table. This step loads images from a directory.

DATA STEP View Code
Data Loading
Action: fetchresult

Load the Cars dataset into the active CAS session for analysis.

DATA STEP View Code
Create Sample Data File
Action: fileInfo

Loads the SASHELP.CARS dataset into CAS and saves it as a CSV file in the active caslib (Casuser) to ensure...

DATA STEP View Code
CAS Session Initialization
Action: filterDesign

Initialize the CAS session to prepare for filter design.

DATA STEP View Code
Creation of Market Basket Data
Action: fism

Creates a dataset 'transactions' representing customer purchases, where 'TransID' identifies the basket and...

DATA STEP View Code
Load Input Image Data
Action: flattenImages

Loads sample images into a CAS table to be used as input for the flattenImages action.

DATA STEP View Code
Session Initialization
Action: flushresult

Start a CAS session to perform actions.

DATA STEP View Code
Create Control Data
Action: fmtLibCntlIn

Create a CAS table named 'formats_data' with format definitions for a traffic light color scheme.

DATA STEP View Code
Create Data for Example
Action: fmtLibCntlOut

Create a new format library named 'demoFmtLib' and add a simple character format '$gender' to it for demons...

DATA STEP View Code
Model Training for Code Generation
Action: forestCode

Load the 'Cars' dataset and train a forest model to predict the 'Origin' of the car. This model table is re...

DATA STEP View Code
Data Loading and Model Training
Action: forestScore

Loads the HMEQ sample dataset and trains a forest model to be used in the scoring examples.

DATA STEP View Code
Load Data to CAS
Action: forestTrain

Loads the sashelp.class dataset into the 'casuser' caslib for analysis.

DATA STEP View Code
Create Functional Data
Action: fPca

Generates a dataset with 100 observations, each containing 50 measurement points (y1-y50) representing a cu...

DATA STEP View Code
Data Creation for Scoring
Action: fPcaScore

Create a CAS table with functional data for scoring. Note: This example assumes an FPCA model table named '...

DATA STEP View Code
Load Sample Data
Action: freq

Loads the 'cars' dataset from the SASHELP library into the 'casuser' CAS library for analysis.

DATA STEP View Code
Load Sample Data
Action: freqTab

Loads the 'cars' dataset from the SAS help library into the CAS session.

DATA STEP View Code
Creation of Simulated Cost Data
Action: frontierCost

Generates a dataset simulating cost, output, and input prices for 100 firms, including a random inefficienc...

DATA STEP View Code
Creation of Production Data
Action: frontierProd

Creates a CAS table with output (log_q) and inputs (log_l, log_k) for production function estimation.

DATA STEP View Code
Load Data for Modeling
Action: gbtreeCode

Loads the HMEQ dataset into the active CAS session to be used for training a gradient boosting model.

DATA STEP View Code
Example Data Preparation (Hypothetical)
Action: gbtreeScore

This is a placeholder for data creation. Actual data creation steps would depend on the specific use case a...

DATA STEP View Code
N/A
Action: getCacheInfo

This action retrieves existing CAS information and does not require explicit data creation in the examples ...

DATA STEP View Code
N/A
Action: getLicenseInfo

The getLicenseInfo action does not require data creation.

DATA STEP View Code
Example Data Creation
Action: glm

This example shows how to create a simple CAS table for use with the `glm` action.

DATA STEP View Code
Example Data for globalReconcile
Action: globalReconcile

To use the `globalReconcile` action, you typically need hierarchical forecast data. This example demonstrat...

DATA STEP View Code
Create Data for GroupByInfo Example
Action: groupByInfo

This is a generic placeholder as no explicit data creation example was found in the provided HTML snippet. ...

DATA STEP View Code
No explicit data creation example found
Action: histogram

The provided HTML documentation does not contain a specific section or example dedicated to data creation f...

DATA STEP View Code
Creation of Input Data
Action: IdentifySpeakers

This action requires an input table with audio data and a pre-trained model for speaker identification. The...

DATA STEP View Code
N/A
Action: importQKBFromURL

The HTML documentation snippet does not contain data creation examples for this action.

DATA STEP View Code
Data Creation
Action: irChart

The HTML document does not contain explicit data creation examples. Here is a generic example for creating ...

DATA STEP View Code
Prerequisite: Loading a QKB
Action: listQKBLocales

Before you can list the locales of a Quality Knowledge Base (QKB), you must first load one into the CAS ses...

DATA STEP View Code
Creating Input Data: n-Gram Language Model and Label Map Tables
Action: lmImport

This SAS code demonstrates how to create a sample n-gram language model table (`myLanguageModel`) and a lab...

DATA STEP View Code
Defining an MPS Problem as a String
Action: loadMps

The 'loadMps' action does not create data in a traditional sense but rather parses a string containing a fu...

DATA STEP View Code
Prerequisites: Importing a QKB
Action: loadQKB

Before you can load a QKB, it must be available to the CAS server. This is typically done by an administrat...

DATA STEP View Code
Create a Sample CSV File
Action: loadTable

This SAS code snippet creates a simple CSV file named 'cars.csv' in the '/cas/data/' directory, which is ac...

DATA STEP View Code
Prerequisite: Have a Binary Model File on the Server
Action: loadTableFromDisk

This action does not create data in the traditional sense. It requires a pre-compiled binary model file (e....

DATA STEP View Code
Creating Sample Data for Logistic Regression
Action: logistic

This SAS code snippet creates a sample CAS table named 'getstarted'. The table contains information about p...

DATA STEP View Code
Data Creation
Action: logisticAssociation

The following code creates the 'mycas.hmeq' table, which is used in the examples. This dataset contains inf...

DATA STEP View Code
Data Creation for Logistic Regression Model
Action: logisticCode

First, we need to create a logistic regression model and save its state. The `logisticCode` action will the...

DATA STEP View Code
Data Creation for Goodness-of-Fit Test
Action: logisticLackfit

This SAS code creates a dataset named 'getheart' with patient information, including a binary outcome 'Stat...

DATA STEP View Code
Data Creation for Logistic Regression
Action: logisticOddsRatio

First, we need a logistic regression model. Let's create a sample dataset 'getheart' and then fit a logisti...

DATA STEP View Code
Data Creation: Sample Home Equity Data
Action: logisticType3

This SAS DATA step creates the `my_hmeq` table in your current caslib. This table contains simulated data a...

DATA STEP View Code
Create a Sample Long-Format Dataset
Action: longToWide

This SAS code creates a sample table named 'sales_long' in the active caslib. The table is in a long format...

DATA STEP View Code
Creating a Sample Dataset
Action: maChart

This example creates a sample CAS table named 'parts' containing diameter measurements for parts manufactur...

DATA STEP View Code
Create Sample Contact Data
Action: match

This example creates a sample CAS table named 'CONTACTS' with names and addresses. This table will be used ...

DATA STEP View Code
Loading Images into a CAS Table
Action: matchImages

Before performing image matching, you must first load your image files into a distributed CAS table. The co...

DATA STEP View Code
Creating the Input Data
Action: maxFlow

This example illustrates calculating the maximum flow between a source node 'S' and a sink node 'T' in a di...

DATA STEP View Code
Create Sample Transaction Data
Action: mbanalysis

This example code creates a simple CAS table named 'sample_transactions' containing transaction data. Each ...

DATA STEP View Code
Creating Sample Data for Clustering
Action: mbcFit

This example demonstrates how to create a CAS table named `my_cas_table` with synthetic data. The table con...

DATA STEP View Code
Data Creation for Scoring
Action: mbcScore

To use the mbcScore action, you first need a model that has been trained using the mbcFit action and saved ...

DATA STEP View Code
Creating the Input Data Set
Action: mca

This example uses a fictional data set about car preferences. The data set contains several nominal variabl...

DATA STEP View Code
Creating Sample Piston Diameter Data
Action: mChart

This SAS DATA step generates a sample dataset named 'mycas.pistons'. It simulates the diameter measurements...

DATA STEP View Code
Data Creation
Action: mdSummary

The following code creates a sample table named 'CARS' in the 'casuser' caslib, which will be used in the e...

DATA STEP View Code
Prerequisite: Running an Action to Generate Metrics
Action: metrics

The `session.metrics` action itself does not require a data table. However, to see its effect, you must run...

DATA STEP View Code
Creating the Arc Data Table
Action: minCostFlow

The following DATA step creates the arc data table `arc_data` for a simple minimum-cost network flow proble...

DATA STEP View Code
Minimum Cut for a Directed Graph
Action: minCut

This section illustrates the use of the minimum-cut algorithm on the directed graph G shown in Figure 163.

DATA STEP View Code
Data Creation: Weighted Links
Action: minSpanTree

Create a CAS table named 'mycas.LinkSetIn' representing a graph. It contains 'from' and 'to' columns for no...

DATA STEP View Code
Create Biased Loan Application Data
Action: mitigateBias

This SAS DATA step creates a synthetic dataset named 'applicant_data' in the CASUSER caslib. It simulates l...

DATA STEP View Code