Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China

Similar documents
A Tool to Compare Different Data Transfers Jun Wang, FMD K&L, Inc., Nanjing, China

PharmaSUG China Paper 70

A SAS Macro Utility to Modify and Validate RTF Outputs for Regional Analyses Jagan Mohan Achi, PPD, Austin, TX Joshua N. Winters, PPD, Rochester, NY

Importing CSV Data to All Character Variables Arthur L. Carpenter California Occidental Consultants, Anchorage, AK

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

Journey to the center of the earth Deep understanding of SAS language processing mechanism Di Chen, SAS Beijing R&D, Beijing, China

TLF Management Tools: SAS programs to help in managing large number of TLFs. Eduard Joseph Siquioco, PPD, Manila, Philippines

Use That SAP to Write Your Code Sandra Minjoe, Genentech, Inc., South San Francisco, CA

Next Presentation: Presenter: Arthur Tabachneck

PharmaSUG Paper PO10

Macro Quoting: Which Function Should We Use? Pengfei Guo, MSD R&D (China) Co., Ltd., Shanghai, China

BIOMETRICS INFORMATION

Basic SAS Hash Programming Techniques Applied in Our Daily Work in Clinical Trials Data Analysis

Create a Format from a SAS Data Set Ruth Marisol Rivera, i3 Statprobe, Mexico City, Mexico

Automated Checking Of Multiple Files Kathyayini Tappeta, Percept Pharma Services, Bridgewater, NJ

An Efficient Tool for Clinical Data Check

How to validate clinical data more efficiently with SAS Clinical Standards Toolkit

CC13 An Automatic Process to Compare Files. Simon Lin, Merck & Co., Inc., Rahway, NJ Huei-Ling Chen, Merck & Co., Inc., Rahway, NJ

PharmaSUG Paper TT11

Benchmark Macro %COMPARE Sreekanth Reddy Middela, MaxisIT Inc., Edison, NJ Venkata Sekhar Bhamidipati, Merck & Co., Inc.

Program Validation: Logging the Log

PharmaSUG China Paper 059

A Macro to Keep Titles and Footnotes in One Place

ODS/RTF Pagination Revisit

Clinical Data Visualization using TIBCO Spotfire and SAS

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

Quick and Efficient Way to Check the Transferred Data Divyaja Padamati, Eliassen Group Inc., North Carolina.

Using an ICPSR set-up file to create a SAS dataset

Chapter 2: Getting Data Into SAS

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

Using Dynamic Data Exchange

Template Versatility Using SAS Macro Language to Generate Dynamic RTF Reports Patrick Leon, MPH

APPENDIX 4 Migrating from QMF to SAS/ ASSIST Software. Each of these steps can be executed independently.

Tweaking your tables: Suppressing superfluous subtotals in PROC TABULATE

How to use UNIX commands in SAS code to read SAS logs

Debugging. Where to start? John Ladds, SAS Technology Center, Statistics Canada.

A Practical Introduction to SAS Data Integration Studio

A Poor/Rich SAS User s Proc Export

HAVE YOU EVER WISHED THAT YOU DO NOT NEED TO TYPE OR CHANGE REPORT NUMBERS AND TITLES IN YOUR SAS PROGRAMS?

SAS Studio: A New Way to Program in SAS

Cover the Basics, Tool for structuring data checking with SAS Ole Zester, Novo Nordisk, Denmark

An Introduction to Macros Deb Cassidy

PharmaSUG China Big Insights in Small Data with RStudio Shiny Mina Chen, Roche Product Development in Asia Pacific, Shanghai, China

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

Producing Summary Tables in SAS Enterprise Guide

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

PharmaSUG Paper PO12

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

SAS Windowing environment Tips and Tricks

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

Paper William E Benjamin Jr, Owl Computer Consultancy, LLC

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

Sorting big datasets. Do we really need it? Daniil Shliakhov, Experis Clinical, Kharkiv, Ukraine

Reading and Writing RTF Documents as Data: Automatic Completion of CONSORT Flow Diagrams

A Time Saver for All: A SAS Toolbox Philip Jou, Baylor University, Waco, TX

Paper HOW-06. Tricia Aanderud, And Data Inc, Raleigh, NC

Paper CC16. William E Benjamin Jr, Owl Computer Consultancy LLC, Phoenix, AZ

PharmaSUG China. Systematically Reordering Axis Major Tick Values in SAS Graph Brian Shen, PPDI, ShangHai

Information Visualization

Application Interface for executing a batch of SAS Programs and Checking Logs Sneha Sarmukadam, inventiv Health Clinical, Pune, India

When Powerful SAS Meets PowerShell TM

So Much Data, So Little Time: Splitting Datasets For More Efficient Run Times and Meeting FDA Submission Guidelines

Advanced Visualization using TIBCO Spotfire and SAS

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

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

BI-09 Using Enterprise Guide Effectively Tom Miron, Systems Seminar Consultants, Madison, WI

Cleaning up your SAS log: Note Messages

DSCI 325: Handout 2 Getting Data into SAS Spring 2017

Greenspace: A Macro to Improve a SAS Data Set Footprint

Implementing external file processing with no record delimiter via a metadata-driven approach

QUEST Procedure Reference

Better Metadata Through SAS II: %SYSFUNC, PROC DATASETS, and Dictionary Tables

Dictionary.coumns is your friend while appending or moving data

A Generalized Macro-Based Data Reporting System to Produce Both HTML and Text Files

A SAS Macro to Generate Caterpillar Plots. Guochen Song, i3 Statprobe, Cary, NC

SAS 101. Based on Learning SAS by Example: A Programmer s Guide Chapter 21, 22, & 23. By Tasha Chapman, Oregon Health Authority

Introduction. CHAPTER 3 Working in the SAS Windowing Environment

A Guided Tour Through the SAS Windowing Environment Casey Cantrell, Clarion Consulting, Los Angeles, CA

Let Hash SUMINC Count For You Joseph Hinson, Accenture Life Sciences, Berwyn, PA, USA

Prove QC Quality Create SAS Datasets from RTF Files Honghua Chen, OCKHAM, Cary, NC

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

An Alternate Way to Create the Standard SDTM Domains

The GEOCODE Procedure and SAS Visual Analytics

This paper describes a report layout for reporting adverse events by study consumption pattern and explains its programming aspects.

Dynamic Projects in SAS Enterprise Guide How to Create and Use Parameters

Top Coding Tips. Neil Merchant Technical Specialist - SAS

LST in Comparison Sanket Kale, Parexel International Inc., Durham, NC Sajin Johnny, Parexel International Inc., Durham, NC

It s not the Yellow Brick Road but the SAS PC FILES SERVER will take you Down the LIBNAME PATH= to Using the 64-Bit Excel Workbooks.

Utilizing the VNAME SAS function in restructuring data files

Make SAS Enterprise Guide Your Own. John Ladds Statistics Canada Paper

What Do You Mean My CSV Doesn t Match My SAS Dataset?

Automation of makefile For Use in Clinical Development Nalin Tikoo, BioMarin Pharmaceutical Inc., Novato, CA

The Demystification of a Great Deal of Files

Reproducibly Random Values William Garner, Gilead Sciences, Inc., Foster City, CA Ting Bai, Gilead Sciences, Inc., Foster City, CA

ABSTRACT MORE THAN SYNTAX ORGANIZE YOUR WORK THE SAS ENTERPRISE GUIDE PROJECT. Paper 50-30

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

Easing into Data Exploration, Reporting, and Analytics Using SAS Enterprise Guide

Creating and Executing Stored Compiled DATA Step Programs

Can you decipher the code? If you can, maybe you can break it. Jay Iyengar, Data Systems Consultants LLC, Oak Brook, IL

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

Transcription:

PharmaSUG China 2015 - Paper PO71 Using GSUBMIT command to customize the interface in SAS Xin Wang, Fountain Medical Technology Co., ltd, Nanjing, China One of the reasons that SAS is widely used as the statistical analysis tool in analyzing data from clinical trials is that SAS code can be documented and rerun at a later time. As a SAS programmer, during our daily work, we often write lots of small scripts to debug the code or explore the data. These scripts could be used repeatedly in the same programs or in different programs. Here we will introduce one SAS command GSUBMIT which will allows us to customize the SAS interface and run a short SAS program with one click. As a result, those small scripts can be used easily and efficiently. Keyword: GSUBMIT, CUSTOMIZE INTRODUCE Different from other Interactive software, SAS code can be documented, so we can get the track of how SAS processing and analyzing data. But sometimes we may type some codes used for set up SAS environment or debug the program or explore the data which do not need to be documented. These kinds of codes may be used every day. In stand of typing or copying them day and day, GSUBMIT command allows us call them with one click by customizing SAS. 1. CUSTOMIZE TOOL BAR Tool Bar is a very important part of SAS, it contains many icons which can submit shot commands. Like many other software, the tool bar in SAS can be customized by user easily. Each of the icons, their placement, and their meanings can be customized. New icons that perform your own tasks can be added. Here is the default tool bar: When customizing it, use the main menus to select TOOLS CUSTOMIZE or right click on the tool bar itself. The CUSTOMIZE TOOLS dialog box is shown. Create a new icon, and separator can add an between the icons. Delete the task. Select an icon for your tool. Move the icon up or down. Enter your command here which will be executed when click the icon. GSUBMIT your SAS code Short description about the task. The text which will show up when you put your mouse on the icon. After you customized your tool bar, you will get it looks like this: 1

Below are some examples: EXAMPLE 1 Delete the temporary data set in work library. GSUBMIT "proc datasets lib=work nolist kill; quit;" EXAMPLE 2 Close the options for debug macro. GSUBMIT options nomlogic nomprint nosymbolgen; EXAMPLE 3 The above two examples may be too simple to demonstrate the convenience of tool bar. However, we can use WINDOW statement to add interaction with tool bar. If we submit the below SAS code, SAS will open a window to ask us the name of data set, after we enter the data set name, all its variable names will be print on the log. data _null_; window DSIN rows=8 columns=80 irow=1 icolumn=2 color=black #2 @3 'Enter data set name: ' color=gray dsin $41. required=yes attr=underline color=yellow; display DSIN blank; file log; length name $32; do dsid = open(dsin,'i') while(dsid ne 0); do i = 1 to attrn(dsid,'nvars'); name = varname(dsid,i); put name @; end; dsid = close(dsid); end; stop; run; Actually the GSUBMIT command only allows 512 characters. So we cannot submit this program directly. This limitation can be circumvented by submitting a macro or an external program. E.g. GSUBMIT %INC your SAS program path/copy_var_name.sas. When using GSUBMIT in an Action Command, all the string must be quoted, and %INCLUDE also expects a quoted string or a fileref, if your path contains a macro variable, be careful, since strings with strings in macro language are often cause issues. 2

After you click the button, you will get this window: Enter the data set name on the line, press enter key, you will see the variable names on your log. EXAMPLE 4 Here is a very useful SAS program which make us check our log automatically, especially when you have a very long log. It helps us check the information we told it. If we add it on the tool bar by GSUBMIT, we can check the log by one click instead of manually through it. Don't forget to change your SAS path when you using it. dm 'log; log; file "your SAS path\checklog.log" REPLACE;'; data log_err log_war log_uni log_mer log_mis log_chr log_num; infile " your SAS path\checklog.log" lrecl=2000 MISSOVER LENGTH=Ll FIRSTOBS=1; input a $varying2000. ll; if a=:'warning: Could not locate style reference' then delete; if index(a, 'ERROR:')>0 then output log_err; else if index(a, 'WARNING:')>0 then output log_war; else if index(a, 'uninitialized')>0 then output log_uni; else if index(a, 'MERGE statement has more than one data set with repeats of BY values')>0 then output log_mer; else if index(a, 'Missing values were generated')>0 then output log_mis; else if index(a, 'Character values have been converted to numeric')>0 then output log_chr; else if index(a, 'Numeric values have been converted to character')>0 then output log_num; run; proc sql noprint; 3

select count(a) into:_logerr from log_err; select count(a) into:_logwar from log_war; select count(a) into:_loguni from log_uni; select count(a) into:_logmer from log_mer; select count(a) into:_logmis from log_mis; select count(a) into:_logchr from log_chr; select count(a) into:_lognum from log_num; quit; data _null_; put @1 80*'='; put @1 "Checking log"; put @1 80*'='; put @1 "log has &_logerr Error"; put @1 "log has &_logwar Warning"; put @1 "log has &_loguni Uninitialized variable"; put @1 "log has &_logmer Merge by more than one value"; put @1 "log has &_logmis Missing values were generated"; put @1 "log has &_logchr Character values converted to numerical"; put @1 "log has &_lognum Numeric values converted to character"; put @1 80*'='; put @1 ' '; put @1 ' '; run; Obviously, we should use GSUBMIT %INC your SAS program path/checklog.sas, since it is longer than 512 character. Below is what you will get in your log after you click the button. Instead of go through all the log, you could only read the last part of the log. Please be aware of that before you click the check log button, you should make sure the content in your log window is exactly what you want to be checked. 2. CUSTOMIZE PULL DOWN MENUS Instead of using WINDOW statement to tell SAS which data set should be manipulated, we can also customize the pull down menu to achieve this kind of functions. Active Explorer window, select TOOLS OPTIONS EXPLORER, select MEMBERS tab, you will get 4

EXPLORERE OPTIONS window. Highlight TABLE line, clicking on the EDIT button, you will get TABLE OPTIONS window. Click ADD button bring you a dialogue box to add your command. Enter a name for the action. & before one letter will underline this letter. Enter the action using %8b for the libref, and %32b for the data set name. After done this, when you right click your mouse on one data set, you will see one more action on the list. EXAMPLE 5 This action will accesses the desired variable names and puts the names into your system s clipboard. After right click your mouse on the data set and select this action, your clipboard will get the variable names of the data, then you can paste them to everywhere you want. GSUBMIT "filename _cb clipbrd;data _null_;file _cb; dsn='%8b' '.' '%32b';length name $32;do dsid = open(dsn,'i') while(dsid ne 0);do i = 1 to attrn(dsid,'nvars');name = varname(dsid,i);put name @;end;dsid = close(dsid);end;run;filename _cb clear;" When you add action commands, removing unnecessary spacing wherever possible, as the action command can only contain up to 255 characters. CONCLUSION Hopefully this paper can give you an inspiration on how to use GSUBMIT to customize SAS interface. You can develop your own action which can made your daily work convenience. REFERENCE Arthur L. Carpenter. 2012. Doing More with the SAS Display Manager: From Editor to View Table - Options and Tools You Should Know. Orlando Florida, US: SAS Global Forum. 5

ACKNOWLEDGEMENTS I would like to thank Chao Wang for his timely efforts in reviewing and providing valuable feedback on this paper. CONTACT INFORMATION Your comments and questions are valued and encouraged. Contact the author at: Name: Xin Wang Enterprise: Fountain Medical Technology Co., ltd Address: Room 403, Building 43, No.70, Headquarter Base, Phoenix Road, Jiangning District City, State ZIP: Nanjing, China 210000 E-mail: xin.wang@fountain-med.com 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. Other brand and product names are registered trademarks or trademarks of their respective companies. 6