SAS Macro Technique for Embedding and Using Metadata in Web Pages. DataCeutics, Inc., Pottstown, PA

Similar documents
Tracking Dataset Dependencies in Clinical Trials Reporting

Using SAS software to shrink the data in your applications

Developing Data-Driven SAS Programs Using Proc Contents

CDISC Variable Mapping and Control Terminology Implementation Made Easy

%MAKE_IT_COUNT: An Example Macro for Dynamic Table Programming Britney Gilbert, Juniper Tree Consulting, Porter, Oklahoma

Making the most of SAS Jobs in LSAF

The Submission Data File System Automating the Creation of CDISC SDTM and ADaM Datasets

SAS Macro Dynamics: from Simple Basics to Powerful Invocations Rick Andrews, Office of Research, Development, and Information, Baltimore, MD

Automating the Production of Formatted Item Frequencies using Survey Metadata

PharmaSUG Paper CC22

Internet/Intranet, the Web & SAS

PharmaSUG Paper CC02

To conceptualize the process, the table below shows the highly correlated covariates in descending order of their R statistic.

Using PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO

How to Incorporate Old SAS Data into a New DATA Step, or What is S-M-U?

PharmaSUG Paper SP04

SAS automation techniques specification driven programming for Lab CTC grade derivation and more

SAS Drug Development Program Portability

for Western Users of SAS Software 2014

PhUSE US Connect 2018 Paper CT06 A Macro Tool to Find and/or Split Variable Text String Greater Than 200 Characters for Regulatory Submission Datasets

PharmaSUG 2013 CC26 Automating the Labeling of X- Axis Sanjiv Ramalingam, Vertex Pharmaceuticals, Inc., Cambridge, MA

Going Under the Hood: How Does the Macro Processor Really Work?

Paper A Simplified and Efficient Way to Map Variable Attributes of a Clinical Data Warehouse

Seamless Dynamic Web (and Smart Device!) Reporting with SAS D.J. Penix, Pinnacle Solutions, Indianapolis, IN

Migration of SAS Software From VMS to Windows NT : A Real Life Story

SAS Visual Analytics Environment Stood Up? Check! Data Automatically Loaded and Refreshed? Not Quite

SAS Online Training: Course contents: Agenda:

A Breeze through SAS options to Enter a Zero-filled row Kajal Tahiliani, ICON Clinical Research, Warrington, PA

Data Quality Review for Missing Values and Outliers

Submission-Ready Define.xml Files Using SAS Clinical Data Integration Melissa R. Martinez, SAS Institute, Cary, NC USA

An Alternate Way to Create the Standard SDTM Domains

Extending the Scope of Custom Transformations

Tired of CALL EXECUTE? Try DOSUBL

Note: Basic understanding of the CDISC ODM structure of Events, Forms, ItemGroups, Items, Codelists and MeasurementUnits is required.

PharmaSUG China Paper 059

Applications Development. Paper 38-28

Regaining Some Control Over ODS RTF Pagination When Using Proc Report Gary E. Moore, Moore Computing Services, Inc., Little Rock, Arkansas

USING DATA TO SET MACRO PARAMETERS

Macro Method to use Google Maps and SAS to Geocode a Location by Name or Address

Useful Tips When Deploying SAS Code in a Production Environment

SAS Application to Automate a Comprehensive Review of DEFINE and All of its Components

SAS (Statistical Analysis Software/System)

Customizing SAS Data Integration Studio to Generate CDISC Compliant SDTM 3.1 Domains

Text Generational Data Sets (Text GDS)

Taming a Spreadsheet Importation Monster

SAS System Powers Web Measurement Solution at U S WEST

Matt Downs and Heidi Christ-Schmidt Statistics Collaborative, Inc., Washington, D.C.

Virtual Accessing of a SAS Data Set Using OPEN, FETCH, and CLOSE Functions with %SYSFUNC and %DO Loops

Data Edit-checks Integration using ODS Tagset Niraj J. Pandya, Element Technologies Inc., NJ Vinodh Paida, Impressive Systems Inc.

WHAT ARE SASHELP VIEWS?

SAS Programming Techniques for Manipulating Metadata on the Database Level Chris Speck, PAREXEL International, Durham, NC

1. Join with PROC SQL a left join that will retain target records having no lookup match. 2. Data Step Merge of the target and lookup files.

The Dataset Diet How to transform short and fat into long and thin

Chaining Logic in One Data Step Libing Shi, Ginny Rego Blue Cross Blue Shield of Massachusetts, Boston, MA

Customized Flowcharts Using SAS Annotation Abhinav Srivastva, PaxVax Inc., Redwood City, CA

Leveraging SAS Visualization Technologies to Increase the Global Competency of the U.S. Workforce

Validation Summary using SYSINFO

SAS Clinical Data Integration 2.4

Conversion of CDISC specifications to CDISC data specifications driven SAS programming for CDISC data mapping

This Too Shall Pass: Passing Simple and Complex Parameters In and Out of Macros

ODS DOCUMENT, a practical example. Ruurd Bennink, OCS Consulting B.V., s-hertogenbosch, the Netherlands

A Practical Introduction to SAS Data Integration Studio

Paper Haven't I Seen You Before? An Application of DATA Step HASH for Efficient Complex Event Associations. John Schmitz, Luminare Data LLC

SAS and the Intranet: How a Comments System Creates In-House Efficiencies Morris Lee, Gilead Sciences, Inc., Foster City, California

A Side of Hash for You To Dig Into

PharmaSUG Paper TT11

Missing Pages Report. David Gray, PPD, Austin, TX Zhuo Chen, PPD, Austin, TX

Best Practice for Creation and Maintenance of a SAS Infrastructure

XML in the DATA Step Michael Palmer, Zurich Biostatistics, Inc., Morristown, New Jersey

Are you Still Afraid of Using Arrays? Let s Explore their Advantages

ABSTRACT INTRODUCTION MACRO. Paper RF

SAS Macro Dynamics - From Simple Basics to Powerful Invocations Rick Andrews, Office of the Actuary, CMS, Baltimore, MD

Using SAS to Control and Automate a Multi SAS Program Process Patrick Halpin, dunnhumby USA, Cincinnati, OH

A Macro that Creates U.S Census Tracts Keyhole Markup Language Files for Google Map Use

Creating Regional Maps with Drill-Down Capabilities Deb Cassidy Cardinal Distribution, Dublin, OH

From Manual to Automatic with Overdrive - Using SAS to Automate Report Generation Faron Kincheloe, Baylor University, Waco, TX

Run your reports through that last loop to standardize the presentation attributes

Create Flowcharts Using Annotate Facility. Priya Saradha & Gurubaran Veeravel

PharmaSUG Paper PO22

Amie Bissonett, inventiv Health Clinical, Minneapolis, MN

One Project, Two Teams: The Unblind Leading the Blind

PharmaSUG Paper PO12

PharmaSUG2014 Paper DS09

A Quick and Gentle Introduction to PROC SQL

A Simple Framework for Sequentially Processing Hierarchical Data Sets for Large Surveys

%MISSING: A SAS Macro to Report Missing Value Percentages for a Multi-Year Multi-File Information System

SAS Clinical Data Integration 2.6

A Macro that can Search and Replace String in your SAS Programs

A Macro to Create Program Inventory for Analysis Data Reviewer s Guide Xianhua (Allen) Zeng, PAREXEL International, Shanghai, China

Planning to Pool SDTM by Creating and Maintaining a Sponsor-Specific Controlled Terminology Database

Power Data Explorer (PDE) - Data Exploration in an All-In-One Dynamic Report Using SAS & EXCEL

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA

Comparison of different ways using table lookups on huge tables

Using Templates Created by the SAS/STAT Procedures

Abstract. Introduction

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment

InfoSphere Master Data Management Reference Data Management Hub Version 10 Release 0. User s Guide GI

There s No Such Thing as Normal Clinical Trials Data, or Is There? Daphne Ewing, Octagon Research Solutions, Inc., Wayne, PA

Choice of Development Tool for the User Interface of a Client-Server Application in a SAS Environment

Transcription:

Paper AD11 SAS Macro Technique for Embedding and Using Metadata in Web Pages Paul Gilbert, Troy A. Ruth, Gregory T. Weber DataCeutics, Inc., Pottstown, PA ABSTRACT This paper will present a technique to develop dynamic user interfaces within a SAS/Intrnet-based clinical reporting application. Our goal was to develop a sophisticated interface while keeping to a single user input screen. In a typical SAS/Intrnet application, user input on one screen is used to dynamically generate further selections on a subsequent screen. For simple applications this can be effective, but can become cumbersome when the application requires multiple screens. Even just two screens can make tasks such as storing and recalling a user's previous selections difficult, as well as make the interface less intuitive. We were able to accomplish our goal by loading the required data into a single page as metadata, making it easily accessible to drive the user selections. SAS macros were used to generate the required metadata and embedded JavaScript. In this paper, we will discuss and share the method that we used. INTRODUCTION The technique presented in this paper is a small part of a clinical reporting application; however, it is a major factor in determining how the user interacts with the system. The goal was to make the user interface as simple and intuitive as possible. In this case, the specific goal was to present all user input required to produce a report on a single web page. The support of this requirement called for the inclusion of client-side scripting to manage the dynamic update of the user selections. For this application, we chose to use JavaScript for our client-side scripting needs. Another major requirement of the system was that it be easily extensible, with the ability to quickly develop and introduce new user input screens to meet ongoing clinical reporting requirements. To this end, a SAS macro was developed to generate the required metadata and embedded JavaScript. A library of JavaScript functions was built to work with the metadata generated by the macro. In this paper, we will review the SAS macro and the use of the accompanying JavaScript functions. PROBLEM The inclusion of multi-level drilldown report selections in the clinical reporting user interface can be implemented by presenting the most general category selection on a screen and then using user input to dynamically generate more specific category selections on subsequent screens. As the drilldown relationships become more complex, the user interface suffers, as the presentation becomes less intuitive and the task of storing and recalling a user s selections across pages becomes difficult. SOLUTION Our solution is to present drilldown selections on a single screen and use client-side scripting to dynamically display the dependent selection menus as the general selections are made. In this way, related selections may remain together and there is no need to store and retrieve the general to specific selections across pages. To illustrate the use of the technique, we created a simple set of multi-level selections using the hierarchy of Compound, Indication and Study. Table 1 below shows the contrived data for imaginary Com pound 1. TABLE 1 Metadata Used Compound Indication Study Display Value Display Value Display Value Study 1 1 Indication 1 1 Study 2 2 Study 3 3 Study 1 4 Compound 1 1 Study 2 5 Indication 2 2 Study 3 6 Study 4 7 Study 5 8 Indication 3 3 Study 1 9 Study 2 10 In order to support the single-screen drilldown selections and dynamically generate the refined selections, the web

document must be loaded with the above metadata. 1. LOADING THE METADATA When the user input screen is first created, the metadata is loaded into the web document, including all the data required for all possible user selections. Though just one of many possible ways to accomplish this task, we chose to use JavaScript arrays as the data structure for our metadata. The example below demonstrates the JavaScript used to generate the metadata arrays. Only the metadata for Compound 1 from Table 1 is shown, although multiple compounds can be supported simultaneously in the same structure. The string, is the delimiter separating the elements to be split into the JavaScript array. var indication_lookup = 1, 1, 1,.split(, ); var indication_value = 1, 2, 3,.split(, ); var indication_display = Indication 1, Indication 2, Indication 3,.split(, ); var study_lookup = 1, 1, 1, 2, 2, 2, 2, 2, 3, 3,.split(, ); var study_value = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,.split(, ); var study_display = Study 1, Study 2, Study 3, Study 1, Study 2, Study 4, Study 5, Study 1, Study 2,.split(, ); 3, Study The compound level data is not generated as metadata in the above arrays, because compound is the starting point of our general to specific selections, so the compound data is defined directly in the top level selection control. This will be apparent later when we look at the HTML source. The metadata consists of three components: a look-up array, a value array, and a display array. The look-up array is used to determine which items are related to the prior selections in the general to specific selection hierarchy. For example, the selection of Compound 1 will return the value 1. This value is compared against the elements in the indication_lookup array. For each element in the look-up array that matches the selected value, an option will be added to the next hierarchical selection control. The corresponding element in the value array is used to set the value property of the added option and the same element in the display array is used to supply the display text for the new option. A SAS macro was created to generate the JavaScript array metadata within the page. The SAS macro serves both to allow many different sources of data to be consistently represented as metadata and to insulate SAS programmers who may not be familiar with JavaScript from the specifics of JavaScript syntax. The source code is shown below. %macro generate_metadata(indata=, metalabel=, metalookup=, metavalue=, metadisplay=, metadelim=%str(, )) proc sort data=&indata( keep=&metalookup &metavalue &metadisplay) nodupkey out=generate_metadata_work; by &metalookup &metavalue &metadisplay; run; data _null_; set generate_metadata_work end=last; file _webout; length lookup value display $32767; retain lookup value display; lookup=trim(lookup) trim(&metalookup); value=trim(value) trim(&metavalue); display=trim(display) trim(&metadisplay); if last then do; put "var &metalabel_lookup = " '"' lookup '"' ".split(" '"' &metadelim '"' ");"; put "var &metalabel_value = " '"' value '"' ".split(" '"' &metadelim '"' ");"; put "var &metalabel_display = " '"' display '"' ".split(" '"' &metadelim '"' ");"; put "var &metalabel = [&metalabel_lookup, &metalabel_value, &metalebel_display];"; end; else do; lookup=trim(lookup) trim(&metadelim); value=trim(value) trim(&metadelim);

display=trim(value) trim(&metadelim); end; run; proc datasets; delete generate_metadata_work; quit; %mend generate_metadata; 2. ACCESSING THE METADATA As general to specific selections are made, additional JavaScript is executed to evaluate the metadata and generate the applicable options into the next selection control in the selection hierarchy. The source code of this JavaScript is shown below. function generateselections(source, destination, arrdisplay, arrvalues, arrlookup) { /* Create object references to the source and destination selection controls */ var osource=document.all. item(source); var odestination=document.all.item(destination); /* Update the destination selection box */ /* Clear all of the entries in the current selection box */ odestination.options.length = 0; /* Populate the destination options */ /* Loop through the metadata arrays, */ /* Insert the available items as selections if the current source selection matches the Lookup value */ for (i=0; i<arrvalues.length; i++) { if (osource.value==arrlookup[i]) { /* Create a new option object and append it to the destination selection box */ var onewoption = document.createelement("option"); odestination.options.add(onewoption); } } /* Set the Display text and value of the new option */ onewoption.innertext = arrdisplay[i]; onewoption.value = arrvalues[i]; } The above function is intended to be called from the onchange event of selection controls. The most general selection control is completely defined within the web document, as the selections at this level do not depend on the choices of the user. However, as a selection is made at this level, the onchange event is initiated and the above function is executed to dynamically produce the options in the next selection control. FUNCTIONAL OVERVIEW The screenshots below depict a sequence of user selections and the resulting selection objects being populated. Following the screenshots will be the HTML and embedded JavaScript code used to generate the selection controls and link to the next selection in the hierarchy using a call to the generateselections() JavaScript function.

<B>Compound:</B><BR> <SELECT size=4 name="compoundselect" onchange="generateselections('compoundselect','indicationselect',indication_display, indication_value, indication_lookup);"> <OPTION value=1>compound 1</OPTION> <OPTION value=2>compound 2</OPTION> <OPTION value=3>compound 3</OPTION> </SELECT> As alluded to above, notice that the options for Compound 1 (value=1), Compound 2, and Compound 3 are defined directly in the HTML. As the options for the indication selection control are dependent upon the compound selection, there are no options pre-defined in HTML for indication, as shown below. In the above simplified example, the user will select a compound. This will trigger a lookup to metadata stored within the web page and generate the next selection box, showing the available indications for the selected compound.

<B>Indication:</B><BR> <SELECT size=4 name="indicationselect" onchange="generateselections('indicationselect','studyselect',study_display, study_value, study_lookup); document.getelementbyid('study').style.display='';"> </SELECT> The screen below shows the result of selecting Indication 2. Only the studies associated with Indication 2 are presented to the user. <B>Study:</B><BR> <SELECT size=4 name="studyselect"> </SELECT>

Since study is the most specific selection category in our example, notice that the HTML to produce the study selection control does not include a call to the generateselections() JavaScript function. This example can be made more robust through the introduction of techniques such as using JavaScript to display and hide the hierarchical selections, until their direct ancestors have been selected and support for multiple selections at one or more selection levels. These and other techniques are beyond the scope of this paper. CONCLUSION The goal was to make the user interface as simple and intuitive as possible. There are several solutions that we could have used to generate and store the single screen user interfaces. The technique employed was chosen because of its adaptability to the various usage scenarios, as well as its encapsulation in SAS macros which can be called knowledgeably by SAS programmers. The library of SAS macros and JavaScript functions that were developed greatly facilitates the rapid creation of report interface screens. Using this technique we were able to present all user input required to produce a report on a single web page. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the authors at: Gregory T. Weber - weberg@dataceutics.com Troy A Ruth - ruth@dataceutics.com Paul Gilbert - gilbertp@dataceutics.com DataCeutics, Inc. (http://www.dataceutics.com) is a SAS Alliance Partner and a CDISC member. 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.