09:37, 21st October 2022
Distinguishing SAS PROC MEANS, SUMMARY, TABULATE
SAS offers three related but distinct procedures for generating descriptive statistics. PROC MEANS computes statistics across all observations or within groups, estimates quantiles, calculates confidence limits and identifies extreme values, with results displayed in the output window. PROC SUMMARY functions identically but writes its results to an output dataset instead. PROC TABULATE builds on both by presenting descriptive statistics in a tabular format, offering greater flexibility in classifying variables, establishing hierarchical relationships and applying labels and formatting, with output available in either the window or a dataset.
In SAS Enterprise Guide, PROC MEANS is accessible via the Describe menu under Summary Statistics, while PROC TABULATE is found under Summary Tables, and PROC SUMMARY requires manual coding. In SAS Studio, only PROC MEANS is available through the Statistics menu, with the other two also requiring code. On SAS Viya, all three procedures use CAS actions when processing CAS tables. While the three procedures are broadly similar in the statistics they produce, PROC TABULATE is generally considered the most versatile due to the greater degree of control it affords over output.
09:35, 21st October 2022
Getting Started with Python Integration to SAS Viya
Peter Styliadis, a Technical Training Consultant at SAS, has compiled an index of articles covering Python integration with SAS Viya, aimed at helping developers and analysts get started with using Python alongside the massively parallel processing CAS engine. The series walks through a broad range of practical topics, beginning with establishing a connection to CAS and progressing through working with CAS actions, loading and exploring data, performing descriptive statistics, filtering and transforming tables, executing SQL and handling missing values, through to more advanced tasks such as creating user-defined functions and connecting to Snowflake. A number of additional learning resources are also signposted, including webinars, a predictive modelling series and guidance on creating Microsoft Excel reports using SAS, Python and SQL together.
20:41, 14th October 2022
Quarto is an open-source platform designed for creating dynamic, reproducible content using programming languages such as Python, R and Julia, enabling users to generate articles, presentations, dashboards and books in formats like HTML, PDF and EPUB. It supports authoring through Markdown with enhanced features for equations, citations and layouts and integrates with tools for publishing to platforms like Posit Connect. Pandoc, a complementary document converter, facilitates the transformation of content between numerous markup and document formats, including Markdown, HTML, LaTeX and Word, while offering customisable citation systems and support for advanced formatting options.
09:25, 14th October 2022
LEAVE and CONTINUE: Two ways to control the flow in a SAS DO loop
The SAS DATA step includes LEAVE and CONTINUE statements that function similarly to break and continue in other programming languages, allowing control over loop execution. LEAVE exits a loop immediately when a condition is met, as demonstrated in a simulation where a coin is tossed until "heads" appears, while CONTINUE skips remaining statements in a loop iteration, useful for scenarios like limiting attempts in a trial.
Alternatives such as DO-UNTIL loops can achieve similar outcomes with clearer exit conditions. The author prefers structured approaches to jump statements, though LEAVE may simplify certain logic. Other SAS languages, like SAS/IML, support these statements with version-specific updates, while GOTO offers another method for control flow, though it is generally avoided for readability. The discussion highlights considerations in balancing simplicity and structured programming practices when managing loop operations.
11:57, 12th October 2022
How to examine the status of ODS destinations in SAS
A SAS programmer may encounter issues where tables and graphs do not display due to the ODS SELECT list being set to restrict output or all ODS destinations being closed, which can occur through programmatic commands. To resolve this, restarting the SAS session resets ODS settings, but if the problem persists, examining the SELECT list and open destinations is necessary.
Using the ODS SELECT ALL statement ensures all output is visible, while procedures like PROC PRINT on the SASHELP.VDEST data view reveal active ODS destinations. Checking the SAS log for notes about closed destinations or restricted SELECT lists helps identify the cause, and adjusting these settings through ODS commands or interface preferences can restore proper output display. Understanding these steps allows users to troubleshoot and manage ODS configurations effectively.
14:04, 3rd October 2022
SASPy Configuration with SAS Analytics Pro Cloud Native
SAS Analytics Pro Cloud Native enables SAS to run within a containerised Docker environment, opening up possibilities for continuous integration and deployment pipelines, as well as integration with other applications. A widely used Python package called SASPy allows data scientists and developers to interact with SAS procedures and data steps from within Python workflows, and one of its connection methods relies on STDIO over SSH. To enable this, the SAS Analytics Pro container must be configured to accept SSH connections, which involves creating the necessary configuration files, adding Linux system capabilities, exposing and mapping the appropriate network port and establishing a passwordless SSH key pair on the host machine. Once SSH access is confirmed through command-line testing, SASPy can be configured via a personal configuration file that specifies the connection details including the path to SAS, the host address, port, user credentials and additional parameters to handle host key checking and file transfer behaviour specific to Docker Desktop on Windows. With the configuration in place and a successful test session returning the expected log output, SASPy is fully operational against the containerised SAS environment.
14:03, 3rd October 2022
SASPy is a Python module that enables interaction with SAS systems through APIs, allowing users to initiate SAS sessions, execute analytics and transfer data between SAS datasets and Pandas dataframes. It supports multiple connection methods, including local and remote SAS sessions, and facilitates the use of Python methods such as describe() and head() for data manipulation. Additional features encompass machine learning, econometrics and quality control implemented via Python classes.
The module requires Python 3.4 or higher, SAS 9.4 or later and Java 7 or higher for specific connection types, and it is compatible with various SAS platforms. Documentation includes installation instructions, configuration details, troubleshooting guidance and examples to aid in implementation.
14:03, 3rd October 2022
The PYTHON procedure in SAS Viya allows Python code to be run as a subprocess of a SAS Compute Server, either as a complete block using SUBMIT and ENDSUBMIT statements or one line at a time in interactive mode using INTERACTIVE and ENDINTERACTIVE statements. In batch mode, processing halts at the first error encountered, whereas interactive mode allows subsequent statements to continue running after an error, making it useful for debugging.
A built-in SAS module is automatically imported into each Python subprocess, providing callback methods that allow variables to be shared between SAS and Python, data to be moved between SAS datasets and Pandas DataFrames, SAS functions to be invoked and SAS code to be submitted directly from within Python. Two environment variables, PROC_PYPATH and PROC_M2PATH, must be configured by an administrator to point to the Python executable and the interface file respectively, and because the SAS Viya platform is locked down by default, the procedure must be explicitly enabled using the ENABLE_AMS option in the LOCKDOWN statement. Connecting to SAS Cloud Analytic Services from within the procedure requires the Python SWAT package along with two additional environment variables providing token-based authentication and an SSL certificate for secure communication.
09:39, 1st October 2022
A script is available to create user home directories in SAS Viya 2020.x by retrieving user identifiers from the identities service, which can be useful when external systems like LDAP do not provide these values. The script requires a specified directory path and SAS Viya environment URL, authenticates using a username, password, or token and generates directories with 0700 permissions owned by the user's uid and gid. It uses tools like jq and must be executed as root, with additional options allowing targeted user processing, ownership adjustments, or regeneration of identifiers if discrepancies arise from changes in the hashing algorithm used for ID generation after 2023.06. The script is provided without warranty or support, and users are advised to review its functionality and requirements before implementation.
09:37, 1st October 2022
Linux / UNIX: Bash Script Sleep or Delay a Specified Amount of Time
The sleep command in Bash scripting is used to introduce delays in Linux and Unix-like systems, with syntax allowing specification of time in seconds, minutes, hours, or days using suffixes such as s, m, h, or d. However, on BSD and macOS systems, the command only accepts seconds as integer values without suffixes.
Examples include pausing for 5 seconds with sleep 5, 2 minutes with sleep 2m, or 1.5 seconds with sleep 1.5 on GNU systems. The command is commonly integrated into scripts for timing between operations, loops, or waiting for processes to complete, while alternatives like the read command with a timeout can also be used for pauses.