Technology Tales

Notes drawn from experiences in consumer and enterprise technology

19:59, 16th October 2017

Moving and Accessing SAS 9.4 Files

The SAS 9.4 programming documentation details updates to procedures and tools for moving and transferring SAS files across different versions and environments. PROC CPORT and PROC CIMPORT now support extended attributes but no longer transfer data miner database catalogue entries from SAS 9.3 or earlier releases. Several autocall macros were introduced in version 9.4M2 to handle transport files in Version 5 and Version 8 formats, with subsequent maintenance releases bringing corrections to record layouts and improvements to macro functionality. From SAS 9.4 onwards, source and target sessions must use compatible encodings when using these procedures, though later versions added support for importing non-UTF-8 data sets into UTF-8 sessions. The documentation also provides guidance on migrating data to UTF-8 encoding to enable multilingual usage and compatibility with SAS Viya, covering topics such as determining current encoding, managing storage considerations and converting various data structures including indexes, integrity constraints and format catalogues.

19:55, 16th October 2017

CHOOSEC

CHOOSEN

IFC

IFN

The IFN and IFC functions in SAS both evaluate a logical expression and return one of up to four possible values depending on whether that expression is true, false or missing, with IFN returning a numeric value and IFC returning a character value. Similarly, the CHOOSEN and CHOOSEC functions select a value from a list of arguments based on an index expression, with negative index values counting backwards through the list, CHOOSEN returning a numeric result and CHOOSEC returning a character one. In a data step, where IFC or CHOOSEC returns a value to a variable that has not previously been assigned a length, that variable is given a length of 200 bytes. All four functions are particularly useful in data step expressions and WHERE clauses where an IF/THEN/ELSE construct would be inconvenient or impractical, though any of those approaches can produce equivalent results.

17:03, 24th April 2017

Performance optimizations you can apply today to load the Piwik JavaScript tracker faster

Improving the loading speed of the Matomo JavaScript tracker can enhance website performance and prevent potential revenue loss due to slow load times. Key strategies include configuring server settings to cache the tracker file, enabling GZIP compression to reduce file size, using DNS preloading to expedite domain lookups and preloading the resource to allow asynchronous loading. Additional advanced techniques involve leveraging a CDN, merging tracking scripts with other JavaScript files, or utilising service workers for offline tracking. These methods aim to optimise the delivery of analytics scripts without compromising user experience or data collection accuracy, ensuring efficient performance while maintaining compliance with evolving privacy standards.

19:55, 21st March 2017

Free and open SAS references/documentation

SAS provides extensive documentation and learning resources through its official support website, which includes training materials, certification information and community forums. Additional platforms such as lexjansen.com offer user-generated papers from global conferences, while websites like robslink.com and GitHub repositories host practical examples and open-source tools. Video tutorials and community discussions further enhance accessibility to SAS knowledge, with users frequently contributing supplementary resources such as forums, blogs and historical archives. These collective efforts aim to support both novice and experienced users in mastering SAS through shared expertise and diverse learning materials.

18:23, 31st January 2017

ODS GRAPHICS Statement

The ODS GRAPHICS statement in SAS enables the creation of graphs through ODS by allowing users to activate or deactivate graphical output using the ON or OFF options. It provides various settings to customise graph appearance, including antialiasing for smoother visuals, border settings, dimensions for height and width, image format specifications and controls for tooltips and legends. Some options, such as antialiasing, are disabled by default for performance reasons when dealing with large datasets, while others like image format and maximum legend area can be adjusted to suit specific requirements. The statement also includes reset functions to revert settings to their default values, and its behaviour may vary depending on system configurations and output destinations. Detailed configuration and additional options are outlined in the SAS Output Delivery System documentation.

17:51, 27th January 2017

Sample 35864: Change line colours and styles for PROC SGPLOT output

Modifying a Style

SAS Focus Areas: Graphics

SAS graphics procedures enable users to customise the visual appearance of graphical output by modifying style elements through the TEMPLATE procedure, which can be used to create new styles based on existing ones or to adjust individual style attributes such as fonts, colours and line styles. Changes can be made at varying levels of specificity, from targeting a single style element such as GraphValueText, which controls tick mark values and legend value descriptions, to modifying the broader GraphFonts and GraphColors elements, which are referenced by multiple other elements throughout a style and can therefore produce more wide-ranging changes to output appearance.

The PROC SGPLOT procedure supports similar customisation of line colours and styles, with sample code available illustrating practical approaches to achieving this. A gallery of graphics samples covers a range of procedures including PROC SGPLOT, PROC SGPANEL, PROC SGSCATTER and PROC GPLOT, offering examples of chart types such as bar charts, area plots, bubble plots and spaghetti plots, while the Graphically Speaking blog provides additional data visualisation guidance with a focus on ODS Graphics.

11:23, 14th November 2016

One informat to rule them all: Read any date into SAS

The ANYDTDTE informat in SAS offers a versatile method for converting diverse date formats into a standardised date value, eliminating the need for multiple specific informats like DATEw. or MMDDYYw. It automatically interprets various date representations, such as "Jul 4, 1776" or "07/04/1776," by relying on the DATESTYLE system option, which defaults to the locale setting. This flexibility allows users to handle non-standardised date inputs efficiently, though interpretation of ambiguous formats like "07/04/1776" depends on regional conventions. Additional informats, such as ANYDTDTM and ANYDTTME, extend this functionality to date/time and time values, providing a unified approach to date and time processing within SAS.

12:36, 19th May 2016

Create conditional formulas in Excel

Excel provides several functions for creating conditional formulas that test whether conditions are true or false and make logical comparisons between expressions. The IF function evaluates a logical condition and returns one value when the condition is true and another value when it is false. The AND function checks whether multiple conditions are all true simultaneously, whilst the OR function determines whether at least one of several conditions is true. The NOT function reverses the logical value of its argument, turning true into false and false into true. These functions can be combined to create more complex conditional formulas that either return logical values or produce other calculations and custom values based on the evaluation of specified conditions. Practical examples demonstrate how these functions work with cell references and values to perform comparisons using operators such as greater than, less than and equality tests.

22:20, 1st March 2016

Michael A. Raithel, drawing on over 32 years of SAS programming experience, presents a humorous take on typical SAS interview question lists with his own collection of 21 deliberately absurd questions and answers. His satirical examples include asking what SAS stands for (the national anthem), whether the DROP or KEEP statement is more powerful (DROP has gravity on its side), and how to run a RUN statement (click the run icon). The list parodies common interview preparation materials by mixing genuine SAS concepts with wordplay, such as noting that PROC THIRTEEN is a mythical procedure, explaining that sorted data sets do not need sorting, and observing that most programmers use the SUBSTR function to extract substrings. Raithel also includes legitimate technical knowledge disguised as jokes, such as the distinction between DO WHILE (evaluated at the top) and DO UNTIL (evaluated at the bottom) loops, which he nicknames stalactite and stalagmite DO statements respectively. His post concludes by warning readers to be wary of lists claiming to show top SAS interview questions, which he suggests are often created by authors lacking substantial programming knowledge or simply generating clickbait. The blog also contains several practical programming tips in other entries, including how to retrieve process ID's on Unix and Linux systems using the SYSJOBID macro variable, how to concatenate SAS libraries dynamically using INSERT and APPEND options, how to identify SAS file types by their extensions, and how to create data sets in different operating system formats using the OUTREP option.

10:38, 10th February 2016

SAS trick: get the LIBNAME statement to create folders for you

Creating directories in SAS using the DLCREATEDIR function allows users to generate folders programmatically, which can be useful for organising output files or managing data storage. However, challenges may arise, such as setting appropriate permissions on Unix systems, which often require external commands like chmod or adjusting umask settings before the SAS session begins. Deleting directories created through this method involves first removing all contents within the folder, as the FDELETE function can only remove empty directories. When exporting data to Excel using PROC EXPORT, ensuring the correct path is specified is crucial, particularly when combining macro variables and directory names. Users must also be mindful of syntax, such as avoiding incorrect function names like DCCREATE, which may lead to errors. These steps, along with proper configuration of SAS options like DLCREATEDIR, help streamline workflows involving file management and data export.

  • The content, images, and materials on this website are protected by copyright law and may not be reproduced, distributed, transmitted, displayed, or published in any form without the prior written permission of the copyright holder. All trademarks, logos, and brand names mentioned on this website are the property of their respective owners. Unauthorised use or duplication of these materials may violate copyright, trademark and other applicable laws, and could result in criminal or civil penalties.

  • All comments on this website are moderated and should contribute meaningfully to the discussion. We welcome diverse viewpoints expressed respectfully, but reserve the right to remove any comments containing hate speech, profanity, personal attacks, spam, promotional content or other inappropriate material without notice. Please note that comment moderation may take up to 24 hours, and that repeatedly violating these guidelines may result in being banned from future participation.

  • By submitting a comment, you grant us the right to publish and edit it as needed, whilst retaining your ownership of the content. Your email address will never be published or shared, though it is required for moderation purposes.