16:12, 18th November 2021
SAS Viya REST APIs
The SAS Viya REST API platform is a comprehensive suite of developer tools designed to allow enterprise application developers to build upon the work of data scientists and model builders using any client technology. The platform covers a broad range of functional areas, including data management, model building and publishing, job execution, authorisation, machine learning automation, event stream processing, fraud compliance and clinical data management. Individual APIs handle specific tasks such as managing files and folders, defining and executing scoring and decision logic, retrieving and querying data, managing user identities and running business rules. More specialist capabilities include real-time watch list screening for financial crime detection, clinical job management, retrieval agent querying for conversational responses and workflow execution based on the BPMN 2.0 standard. Supporting resources include a developer community forum and code examples hosted on GitHub, and the full list of APIs can be browsed alphabetically or filtered by category.
08:13, 18th November 2021
{fusen} is now available on CRAN!
The fusen R package, developed by ThinkR, is now available on CRAN and offers R users a streamlined way to build fully documented and tested packages from a single R Markdown file. Rather than writing code, examples and tests across multiple separate directories, developers can consolidate everything into one file and use a single inflate command to generate a complete package structure. The package is intended to lower the barrier to entry for those who have never built an R package before, while also benefiting experienced developers who want a more efficient workflow. It is particularly suited to data analysts who already use R Markdown for reproducibility and want to formalise their work into a robust, shareable package. By combining {fusen} with version control tools such as Git, users can keep track of changes and make their work easier for colleagues to understand, adapt and reproduce.
14:53, 17th November 2021
Python's try/except mechanism provides a structured way to handle runtime errors, preventing programmes from crashing unexpectedly. The try block contains code that is tested for errors, while the except block defines how those errors are handled, with the option to specify multiple except blocks for different error types. An else block can be included to run code only when no errors occur, and a finally block executes regardless of whether an error was raised, making it useful for closing files or freeing up resources. Developers can also manually trigger errors using the raise keyword, allowing custom exceptions with specific messages to be thrown when particular conditions are met.
12:18, 10th November 2021
Increment and Decrement operators in Python
Unlike languages such as C++, Python does not support the ++ or -- increment and decrement operators, instead relying on the += and -= assignment operators, or equivalent arithmetic expressions such as x = x + 1 and y = y - 1. The += operator adds a specified value to a variable, making it useful for counters, loops and numeric updates, while -= subtracts a specified value, commonly applied in similar contexts such as tracking declining quantities.
Both operators work with numeric data types, though it is worth noting that -= cannot be used with strings and will raise a TypeError if attempted, whereas += can be used with strings to concatenate additional characters. These approaches are considered more explicit and readable than shorthand operators found in other languages, and they achieve the same practical outcomes when managing variables within everyday Python code.
16:38, 4th November 2021
Error: No CurrentVersion entry in Software/JavaSoft registry
When installing the xlsx package in R, users may encounter an error related to a missing CurrentVersion entry in the Software/JavaSoft registry, which typically occurs because the architecture of the installed Java version does not match that of the R installation. To resolve this, users should first verify their Java version by running java -version in the command prompt, then open RStudio and navigate to Tools, Global Options, and General Settings, where the R version can be changed to one that matches the architecture of the Java installation. Once the correct architecture is selected and the settings are applied, the package should load without further issues.
08:55, 2nd November 2021
How To Add Labels to Grouped Barplot with Bars Side-By-Side in R?
How to Annotate Bars in Grouped Barplot in Python?
The process of adding annotations to grouped barplots involves using specific functions within plotting libraries to display values directly on the bars. In R, ggplot2's annotate function allows for precise placement of text, with adjustments made to the height and position of labels to ensure clarity. Similarly, in Python, Matplotlib's annotate method is employed after generating a grouped barplot with Seaborn, where each bar's height and coordinates are accessed to place text accurately.
Customisations such as formatting numerical values and adjusting text positioning are common to enhance readability, ensuring annotations fit within the visual constraints of the plot. Both approaches require careful handling of data and visual elements to balance information density with aesthetic appeal.
12:47, 21st October 2021
SAS Problem Note 31278: Table 1 node generated by PROC REPORT
When PROC REPORT output is routed to ODS HTML, PDF or RTF destinations and a table of contents is generated, three default nodes are included: "The Report Procedure", "Detailed and/or summarized report" and "Table 1". Each of these nodes can be customised using specific SAS statements and options, with the first controlled via the ODS PROCLABEL statement, the second via the CONTENTS= option on the PROC REPORT statement and the third via the CONTENTS= option on the BREAK BEFORE statement. For PDF output, specifically, the PDFTOC option can be used to control how many levels of the table of contents are visible by default in the PDF reader.
15:28, 8th October 2021
Scroll-linked Effects in Web Pages
Scroll-linked effects are webpage interactions where elements change based on scroll position, such as parallax scrolling, but these can perform poorly in modern browsers that use asynchronous scrolling to maintain a smooth 60 frames per second experience. Because asynchronous scrolling updates the visual scroll position on the compositor thread before the scroll event fires on the main thread, JavaScript-driven scroll effects tend to lag behind what the user sees, resulting in jittery behaviour.
Often, these effects can be reimplemented using native CSS properties, such as position sticky or scroll snap, which allow the browser to handle the animations on the compositor thread without relying on JavaScript event listeners. Firefox will display a developer console warning when it detects a scroll-linked effect on a page, and there are ongoing proposals to better support such effects at the compositor level in future, including Web Animations and CompositorWorker, each carrying their own advantages and disadvantages. Developers working with scroll-linked effects are encouraged to share their use cases to help inform how such support might be improved.
18:24, 5th October 2021
Scrape Data from PDF Files Using Python
Data stored in PDF files can be difficult to work with, but the Python library tabula-py makes it possible to extract and reshape that data into a usable tabular format. For structured PDF data, the library can automatically detect rows and columns, or the user can manually specify the coordinates of the target area. For unstructured data, such as payroll records with mixed layouts, additional steps are required, including importing the raw data as a DataFrame, creating row identifiers using regular expressions and the Pandas cumulative sum function, reshaping the data from long to wide format using the pivot function, and finally merging the resulting DataFrames into a single, clean panel dataset. Throughout the process, trial and error is often needed to fine-tune coordinate values and determine whether to use stream or lattice mode for column detection. Automating this kind of PDF extraction can save organisations considerable time and effort compared to manual processing, though users should always verify they have permission to scrape any given file before doing so.
14:14, 5th October 2021
SYSODSESCAPECHAR Automatic Macro Variable
The SYSODSESCAPECHAR automatic macro variable in SAS is a read-only variable that stores the hexadecimal representation of the current ODS escape character set within a programme. When a character is assigned using the ODS ESCAPECHAR= option, the variable captures and reflects that value in its hexadecimal form, meaning that a character such as the hash symbol would be stored as its corresponding hex value of 23. This behaviour applies consistently regardless of whether the escape character is defined as a standard character or specified directly in hexadecimal notation, and where a multi-character string is provided, only the first character is used.