Learn to Impress - Hidden base SAS features. Peter Crawford Crawford Software Consultancy Limited 1 of 21

Similar documents
More Hidden Base SAS Features to Impress Your Colleagues

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

ERROR: ERROR: ERROR:

Learn to Please: Creating SAS Programs for Others

Reading data in SAS and Descriptive Statistics

INTRODUCTION TO SAS HOW SAS WORKS READING RAW DATA INTO SAS

Understanding the Concepts and Features of Macro Programming 1

The Programmer's Solution to the Import/Export Wizard

Storing and Reusing Macros

Base and Advance SAS

Review of PC-SAS Batch Programming

Acknowledgments xi Preface xiii About the Author xv About This Book xvii New in the Macro Language xxi

Using SAS to Parse External Data

Using Dynamic Data Exchange

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

Chapter 7 File Access. Chapter Table of Contents

WRITE SAS CODE TO GENERATE ANOTHER SAS PROGRAM

Tutorial: set up of measurement recipe with database

SAS/ACCESS 9.2. Interface to PC Files Reference. SAS Documentation

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

Paper SAS Programming Conventions Lois Levin, Independent Consultant, Bethesda, Maryland

Write SAS Code to Generate Another SAS Program A Dynamic Way to Get Your Data into SAS

SAS Online Training: Course contents: Agenda:

Using SAS Enterprise Guide to Coax Your Excel Data In To SAS

Effective ways of handling various file types and importing techniques using SAS 9.4

The INPUT Statement: Where It

Let SAS Play a Pivotal Role in Your Life

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

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

Main Window. Overview. Do this Click the New Report link. Create a New Report.

SAS CURRICULUM. BASE SAS Introduction

2997 Yarmouth Greenway Drive, Madison, WI Phone: (608) Web:

The Output Bundle: A Solution for a Fully Documented Program Run

Other Data Sources SAS can read data from a variety of sources:

SAS Programming Conventions Lois Levin, Independent Consultant

Applications Development

A Practical Introduction to SAS Data Integration Studio

SAS/ACCESS Interface to PC Files for SAS Viya 3.2: Reference

Preserving your SAS Environment in a Non-Persistent World. A Detailed Guide to PROC PRESENV. Steven Gross, Wells Fargo, Irving, TX

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

Using DDE with Microsoft Excel and SAS to Collect Data from Hundreds of Users

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

April 4, SAS General Introduction

The SAS interface is shown in the following screen shot:

Syntax Conventions for SAS Programming Languages

Consolidate Trial Balances

Automate Clinical Trial Data Issue Checking and Tracking

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

Using SAS Metadata as a Key Performance Indicator!

Procedures. PROC CATALOG CATALOG=<libref.>catalog <ENTRYTYPE=etype> <KILL>; CONTENTS <OUT=SAS-data-set> <FILE=fileref;>

Improving Your Relationship with SAS Enterprise Guide Jennifer Bjurstrom, SAS Institute Inc.

SAS/Warehouse Administrator Usage and Enhancements Terry Lewis, SAS Institute Inc., Cary, NC

Queries give database managers its real power. Their most common function is to filter and consolidate data from tables to retrieve it.

Exchanging data between SAS and Microsoft Excel

Macro Facility. About the Macro Facility. Automatic Macro Variables CHAPTER 14

Introduction to DATA Step Programming: SAS Basics II. Susan J. Slaughter, Avocet Solutions

CHAPTER 1 Using the SAS Data Quality Server Software

Chapter 2: Getting Data Into SAS

SAS Strategy Management 5.2 Batch Maintenance Facility

Tips for Mastering Relational Databases Using SAS/ACCESS

New York State Department of Health Medicaid Perinatal Care Quality Improvement Project

Objectives Reading SAS Data Sets and Creating Variables Reading a SAS Data Set Reading a SAS Data Set onboard ia.dfwlax FirstClass Economy

Procedure for Stamping Source File Information on SAS Output Elizabeth Molloy & Breda O'Connor, ICON Clinical Research

Paper AP14 Modifying The LogParse PassInfo Macro to Provide a Link between Product Usage in Rtrace Log and Time Used in Job Log

Untangling and Reformatting NT PerfMon Data to Load a UNIX SAS Database With a Software-Intelligent Data-Adaptive Application

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

SAS PROGRAM EFFICIENCY FOR BEGINNERS. Bruce Gilsen, Federal Reserve Board

Bruce Gilsen, Federal Reserve Board

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

Application Note. Connecting a S S7A Driver V

Alias Macros, a Flexible Versioning System for Standard SAS Macros

Quick Trial Balance Pro - Consolidate Trial Balances. Introduction

The Definitive Guide to Preparing Your Data for Tableau

The INPUT Statement: Where

BASICS BEFORE STARTING SAS DATAWAREHOSING Concepts What is ETL ETL Concepts What is OLAP SAS. What is SAS History of SAS Modules available SAS

Job Security: Using the SAS Macro Language to Full Advantage

SAS/ACCESS Interface to PC Files for SAS Viya : Reference

EG 4.1. PC-SAS users. for. I C T EG 4.1 for PC-SAS Users. Thursday - May 7 th, 2009

An Introduction to SAS University Edition

KISSsys Instruction: Using and Manipulating the Table of Variants. 1 Introduction

Using SAS/SHARE More Efficiently

II-7Numeric and String Variables

Arthur L. Carpenter California Occidental Consultants, Oceanside, California

PROVIDING USER FRIENDLY ACCESS AND SUBSETTING CAPABILITIES TO NON-SAS DATA ACROSS OPERATING PLATFORMS.

From An Introduction to SAS University Edition. Full book available for purchase here.

Using Maps with the JSON LIBNAME Engine in SAS Andrew Gannon, The Financial Risk Group, Cary NC

Paper Phil Mason, Wood Street Consultants

Contents of SAS Programming Techniques

SAS2VBA2SAS: Automated solution to string truncation in PROC IMPORT Amarnath Vijayarangan, Genpact, India

Excel 2007 Pivot Table Sort Column Headings

MARK CARPENTER, Ph.D.

A Picture Is Worth A Thousand Data Points - Increase Understanding by Mapping Data. Paul Ciarlariello, Sinclair Community College, Dayton, OH

ET01. LIBNAME libref <engine-name> <physical-file-name> <libname-options>; <SAS Code> LIBNAME libref CLEAR;

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

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

SUGI 29 Data Warehousing, Management and Quality

<:ards,. The SAS" Macro: An Aid to the User 3' pfbl:me~~&j1tbc(lpt; 2435 procopt; RESOLVED RESOLVED

Your Own SAS Macros Are as Powerful as You Are Ingenious

Using a HASH Table to Reference Variables in an Array by Name. John Henry King, Hopper, Arkansas

Moving Data and Results Between SAS and Excel. Harry Droogendyk Stratia Consulting Inc.

Transcription:

Peter Crawford Crawford Software Consultancy Limited 1 of 21

Learn hidden features in base SAS to impress colleagues Peter Crawford

So many features So much to learn So much being added to SAS languages So hard to keep up So, add some ideas from outside the box Some hidden nuggets (probably) not in courses Peter Crawford Crawford Software Consultancy Limited 3 of 21

6 GEMS (hidden nuggets in SAS languages) 1. _DATA_ - protect your interests (and others) 2. Use global characters in path on INFILE just in unix 3. /*.csv need not start a comment block 4. INFORMAT $ANYFDT what ANYDTxxx chooses 5. Macros hidden among SASAUTOS 6. Profile to review flow through data step Peter Crawford Crawford Software Consultancy Limited 4 of 21

Gem 1 _DATA_ - protects your interests DATA ; WORK.DATA1 WORK.DATA2 WORK.DATA3 OUT= _DATA_ ; DATAn convention %let sorted_input_data= &SYSLAST ; No worry of overwriting Peter Crawford Crawford Software Consultancy Limited 5 of 21

2 Global characters on INFILE unix d:\path\*.csv NOXCMD /*/*.csv Protect server INFILE &PATH/*.sas FILENAME= varname Peter Crawford Crawford Software Consultancy Limited 6 of 21

2.1 Global characters on INFILE unix Project1 Import Routines Code1 Logs data Cleanse Code2 Logs data Summarize Summary_code Logs data Derivation Excel models Test results Test code Analysis Analytic code Present Peter Crawford Crawford Software Consultancy Limited 7 of 21 Performance code /Pr*/*/*ode*/*.sas Only.sas files

3 /*.csv need not start a comment block D:\path\*.csv /*block comment*/? global character /*/*.csv /?*not a comment*/ 1 single character Relax, /?* won t be misinterpreted Peter Crawford Crawford Software Consultancy Limited 8 of 21

4 informat $ANYFDT what ANYDTxxx. chose Ad hoc PROC Import As you go any informat will do Informat ANYDTDTE. Agreed data structure Only agreed informats informat $ANYFDT. Explains what informat ANYDTxxx would choose on each row in each column Peter Crawford Crawford Software Consultancy Limited 9 of 21 9 of 23 Peter Crawford More Features to Impress

5 Macros hidden among SASAUTOS SAS Autocall library FILEREF sasautos DATA Step read input @'%macro ' macname ; Simple but! Simple but case-sensitive Peter Crawford Crawford Software Consultancy Limited 10 of 21

5.1 Macros hidden among SASAUTOS data all_provided_macros ; length filename filen $1000 macname $33 ; infile sasautos('*.sas') filename= filen dlm= ';(/% '; input @'%macro ' macname ; filename= filen ; run ; But this is case-sensitive Peter Crawford Crawford Software Consultancy Limited 11 of 21

5.2 Macros among SASAUTOS case-sensitive results Peter Crawford Crawford Software Consultancy Limited 12 of 21

5.3 Macros hidden among SASAUTOS input @'%macro ' macname ; input @ ; pos = find( _infile_, '%macro ', 'I' ) ; if pos ; input @(pos+6) macname ; Case sensitive Insensitive WHERE lowcase(macname) ne scan( filename, -2, './' ); Peter Crawford Crawford Software Consultancy Limited 13 of 21

5.4 Macros hidden among SASAUTOS WHERE lowcase(macname) ne scan( filename, -2, '.\/' ); Peter Crawford Crawford Software Consultancy Limited 14 of 21

5.5 Macros hidden among SASAUTOS NOTE: The data set WORK.PROVIDED_MACROS2 has 682 observations and 3 variables. NOTE: DATA statement used (Total process time): real time 0.64 seconds cpu time 0.72 seconds 65 proc print n ; 66 WHERE lowcase(macname) ne scan( filename, -2, '.\/' ); 67 run ; NOTE: There Peter were Crawford 410 observations Crawford Software read Consultancy from Limited the data set WORK.PROVIDED_MACROS2 15 of 21 WHERE LOWCASE(macname) not = SCAN(filename, -2, '.\/'); NOTE: PROCEDURE

6. Profile a data step - Review data flow CPU time by statement big overhead Internal option many iterations to show to solve a big problem DSOPTIONS= profile It s a relative judgment Peter Crawford Crawford Software Consultancy Limited 16 of 21

6.1 Profile a data step statement counts and cpu Peter Crawford Crawford Software Consultancy Limited 17 of 21

6.2 Profile a data step step cpu statistics Peter Crawford Crawford Software Consultancy Limited 18 of 21

6.3 Profile a data step step cpu case sensitive Peter Crawford Crawford Software Consultancy Limited 19 of 21

6.4 Profile a data step statements case sensitive Peter Crawford Crawford Software Consultancy Limited 20 of 21

So many features Thank you for listening So much to learn So much being added I can to take SAS questions languages So hard to keep up So, add some ideas from If time outside permits the box Some hidden Peter.Crawford@blueyonder.co.uk nuggets (probably) not in courses Peter Crawford Crawford Software Consultancy Limited 21 of 21 21 of 23 Peter Crawford More Features to Impress

This layout is for full screen media only

Peter Crawford Crawford Software Consultancy Limited 25 of 21