Compute Blocks in Report

Size: px
Start display at page:

Download "Compute Blocks in Report"

Transcription

1 Compute Blocks in Report

2 Compute Blocks Though it is always possible to compute new variables inside a data step, PROC REPORT allows for similar computations to be done internally as well. Computations are handled inside compute blocks syntax: compute attribute; SAS Statements The attribute may be a new variable, which will need to be defined in the column statement and likely given a define statement, but it may also be a different object. In either case, it is a block that opens with compute and is closed with endcomp.

3 Basic Example Given the report code below (and associated formats, not shown), suppose we want to change the birth weight summaries to pounds. proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean 'Mean Birth Weight (oz.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; run;

4 Basic Example Instead of creating a new data set with that variable, we can complete this in report: proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg wt_lb; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean 'Mean Birth Weight (oz.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; compute wt_lb; run; wt_lb=avg/16;

5 Basic Example Instead of creating a new data set with that variable, we can complete this in report: proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg wt_lb; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean 'Mean Birth Weight (oz.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; compute wt_lb; run; wt_lb=avg/16; Define a compute block for that variable including its definition (based on the alias) Add a variable

6 Partial Result

7 Compute Blocks Rules: When computing a new variable, the compute block must reference that variable name in its opening line. Though the compute block may consist of several internal statements, one of these must assign a value to the variable. Any computations can only be based on variables/aliases that are in the column statement and also precede the computed variable. For summary statistics generated using an aliased column, refer to the alias for computations. If it is not aliased, the reference is variable.stat-keyword. Since no define statement is active, the column is established with the most basic options, but adding define options is possible:

8 Basic Example--Extended Instead of creating a new data set with that variable, we can complete this in report: proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg wt_lb; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean 'Mean Birth Weight (oz.)' format=8.2; define wt_lb/computed 'Mean Birth Weight (lb.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; compute wt_lb; run; wt_lb=avg/16;

9 Basic Example--Extended Instead of creating a new data set with that variable, we can complete this in report: proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg wt_lb; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean 'Mean Birth Weight (oz.)' format=8.2; define wt_lb/computed 'Mean Birth Weight (lb.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; compute wt_lb; run; wt_lb=avg/16; Note the computed attribute

10 Partial Result

11 Basic Example--Extended Of course, I may well not want to display both pounds and ounces, but I cannot simply remove the column for pounds--you can try it, but remember this rule: Any computations can only be based on variables/aliases that are in the column statement and also precede the computed variable. So it is sometimes necessary to include a variable (or aliased version of it) in the column statement, but not have it actually display in the report. This can be accomplished with the noprint option in the define statement

12 Basic Example--Extended Instead of creating a new data set with that variable, we can complete this in report: proc report data=stt592.birthweight nowd; where race le 9 and smoke le 3; column smoke race gestation birth_wt=num birth_wt=avg wt_lb; define smoke /format=smoking. group 'Smoking Status'; define gestation/format=term. group 'Gestation Period'; define race/format=race. group "Mother's Race"; define num/n 'Number of Cases'; define avg/mean noprint; define wt_lb/computed 'Mean Birth Weight (lb.)' format=8.2; break after race/skip; break after smoke/summarize ol skip suppress; compute wt_lb; run; wt_lb=avg/16;

13 Partial Result

14 More Advanced Example Using the crew dataset and the following report, suppose I want to add a column for raise, which is 5% for Flight Attendants, 7% for pilots: proc report data=stt592.crew nowd headline headskip; column jobcode location salary=number salary=meansal salary=stdsal; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; run;

15 More Advanced Example Just like the data step, if-then-else logic is permissible, as are the functions that were useful before: proc report data=stt592.crew nowd headline headskip; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute avgraise; run; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal;

16 Result

17 Result Are these right?

18 Try this proc report data=stt592.crew nowd headline headskip; column jobcode location salary=number salary=meansal salary=stdsal; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute avgraise; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else if substr(jobcode,1,1) eq P then avgraise=0.07*meansal; run; What s going on?

19 More Advanced Example I may need to be careful when working with group variables, particularly when they do not appear on all lines. proc report data=stt592.crew nowd headline headskip; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute avgraise; run; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal;

20 More Advanced Example I may need to be careful when working with group variables, particularly when they do not appear on all lines. I can track, sort of, using a data set: proc report data=stt592.crew nowd headline headskip out=check; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute avgraise; run; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal; This creates an output data set that tracks much of the REPORT process

21 Output Data Set

22 Output Data Set Still deceiving, these values are not all present when report is written.

23 More Advanced Example We need to establish a value for the job code group when (or before) we enter it that will remain consistent throughout, avoiding the skipping of the values. Compute blocks also allow us to use targets, much like break/rbreak statements to get values at certain locations within the report. If we use break lines of any type, report also tracks them with the _break_ variable (look back at the last data set)

24 More Advanced Example Improvement: proc report data=stt592.crew nowd headline headskip out=check; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute before jobcode; job=substr(jobcode,1,1); compute avgraise; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal; run;

25 More Advanced Example Improvement: proc report data=stt592.crew nowd headline headskip out=check; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute before jobcode; job=substr(jobcode,1,1); compute avgraise; run; if substr(jobcode,1,1) eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal; Compute the value I want to condition on at the top of the jobcode group

26 More Advanced Example Improvement: proc report data=stt592.crew nowd headline headskip out=check; column jobcode location salary=number salary=meansal salary=stdsal avgraise; define jobcode/ 'Position' group width=10; define location/ group; define number/ n 'Number of obs.' width=6; define meansal/ mean 'Mean Salary' format=dollar12.2; define stdsal/ std 'Standard Deviation' format=dollar12.2; define avgraise/ computed 'Mean Raise' format=dollar12.2; break after jobcode/summarize ol skip suppress; rbreak after/ summarize dol; compute before jobcode; job=substr(jobcode,1,1); compute avgraise; run; if job eq 'F' then avgraise=0.05*meansal; else avgraise=0.07*meansal; Now the value is consistent and useable for conditioning to compute the raise. Take a look at the output data set from this case

27 Result Did we get them all right?

28 Result This will take a bit of work

MULTI-WAY TABLES IN REPORT

MULTI-WAY TABLES IN REPORT MULTI-WAY TABLES IN REPORT Consider The following PROC REPORT: proc format; value smk 0='Never Smoked' 1='Currently Smoke' 2='Stopped at Pregnancy' 3='Stopped Before Current Pregnancy' 9='Unknown' ; value

More information

PROC REPORT Basics: Getting Started with the Primary Statements

PROC REPORT Basics: Getting Started with the Primary Statements Paper HOW07 PROC REPORT Basics: Getting Started with the Primary Statements Arthur L. Carpenter California Occidental Consultants, Oceanside, California ABSTRACT The presentation of data is an essential

More information

PROC REPORT AN INTRODUCTION

PROC REPORT AN INTRODUCTION Table Generation Using the PROC REPORT Feature Edward R. Smith, Senior Scientific Programmer Covance Periapproval Services Inc, Radnor, PA ABSTRACT The PROC REPORT procedure is a powerful report generation

More information

Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA

Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA Using PROC REPORT to Cross-Tabulate Multiple Response Items Patrick Thornton, SRI International, Menlo Park, CA ABSTRACT This paper describes for an intermediate SAS user the use of PROC REPORT to create

More information

EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE

EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE EXAMPLES OF DATA LISTINGS AND CLINICAL SUMMARY TABLES USING PROC REPORT'S BATCH LANGUAGE Rob Hoffman Hoffmann-La Roche, Inc. Abstract PROC REPORT Is a powerful report writing tool which can easily create

More information

10 The First Steps 4 Chapter 2

10 The First Steps 4 Chapter 2 9 CHAPTER 2 Examples The First Steps 10 Invoking the Query Window 11 Changing Your Profile 11 ing a Table 13 ing Columns 14 Alias Names and Labels 14 Column Format 16 Creating a WHERE Expression 17 Available

More information

Basic Concepts #6: Introduction to Report Writing

Basic Concepts #6: Introduction to Report Writing Basic Concepts #6: Introduction to Report Writing Using By-line, PROC Report, PROC Means, PROC Freq JC Wang By-Group Processing By-group processing in a procedure step, a BY line identifies each group

More information

The REPORT Procedure CHAPTER 32

The REPORT Procedure CHAPTER 32 859 CHAPTER 32 The REPORT Procedure Overview 861 Types of Reports 861 A Sampling of Reports 861 Concepts 866 Laying Out a Report 866 Usage of Variables in a Report 867 Display Variables 867 Order Variables

More information

So You're Still Not Using PROC REPORT. Why Not?

So You're Still Not Using PROC REPORT. Why Not? Paper 149-26 So You're Still Not Using PROC REPORT. Why Not? Ray Pass, Ray Pass Consulting Daphne Ewing, Synteract, Inc. ABSTRACT Everyone who can spell SAS knows how to use PROC PRINT. Its primary use

More information

Remove this where. statement to produce the. report on the right with all 4 regions. Retain this where. statement to produce the

Remove this where. statement to produce the. report on the right with all 4 regions. Retain this where. statement to produce the Problem 4, Chapter 14, Ex. 2. Using the SAS sales data set, create the report shown in the text. Note: The report shown in the text for this question, contains only East & West region data. However, the

More information

Advanced PROC REPORT: Doing More in the Compute Block

Advanced PROC REPORT: Doing More in the Compute Block Paper TU02 Advanced PROC REPORT: Doing More in the Compute Block Arthur L. Carpenter California Occidental Consultants ABSTRACT One of the unique features of the REPORT procedure is the Compute Block.

More information

Utilizing SAS for Cross- Report Verification in a Clinical Trials Setting

Utilizing SAS for Cross- Report Verification in a Clinical Trials Setting Utilizing SAS for Cross- Report Verification in a Clinical Trials Setting Daniel Szydlo, SCHARP/Fred Hutch, Seattle, WA Iraj Mohebalian, SCHARP/Fred Hutch, Seattle, WA Marla Husnik, SCHARP/Fred Hutch,

More information

The REPORT Procedure: A Primer for the Compute Block

The REPORT Procedure: A Primer for the Compute Block Paper TT15-SAS The REPORT Procedure: A Primer for the Compute Block Jane Eslinger, SAS Institute Inc. ABSTRACT It is well-known in the world of SAS programming that the REPORT procedure is one of the best

More information

Final Exam. STT 305 Summer 2017

Final Exam. STT 305 Summer 2017 Final Exam STT 305 Summer 2017 Question 1 For the text file and code given at the right, which is the correct data set? Answer A Here Answer B Here Figure Answer C Here No data set is produced, the input

More information

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

There s No Such Thing as Normal Clinical Trials Data, or Is There? Daphne Ewing, Octagon Research Solutions, Inc., Wayne, PA Paper HW04 There s No Such Thing as Normal Clinical Trials Data, or Is There? Daphne Ewing, Octagon Research Solutions, Inc., Wayne, PA ABSTRACT Clinical Trials data comes in all shapes and sizes depending

More information

An Introduction to PROC REPORT

An Introduction to PROC REPORT Paper BB-276 An Introduction to PROC REPORT Kirk Paul Lafler, Software Intelligence Corporation, Spring Valley, California Abstract SAS users often need to create and deliver quality custom reports and

More information

Compute; Your Future with Proc Report

Compute; Your Future with Proc Report Paper PO10 Compute; Your Future with Proc Report Ian J Dixon, GlaxoSmithKline, Harlow, UK Suzanne E Johnes, GlaxoSmithKline, Harlow, UK ABSTRACT PROC REPORT is widely used within the pharmaceutical industry

More information

David Beam, Systems Seminar Consultants, Inc., Madison, WI

David Beam, Systems Seminar Consultants, Inc., Madison, WI Paper 150-26 INTRODUCTION TO PROC SQL David Beam, Systems Seminar Consultants, Inc., Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps

More information

PharmaSUG Paper PO12

PharmaSUG Paper PO12 PharmaSUG 2015 - Paper PO12 ABSTRACT Utilizing SAS for Cross-Report Verification in a Clinical Trials Setting Daniel Szydlo, Fred Hutchinson Cancer Research Center, Seattle, WA Iraj Mohebalian, Fred Hutchinson

More information

Part 1. Getting Started. Chapter 1 Creating a Simple Report 3. Chapter 2 PROC REPORT: An Introduction 13. Chapter 3 Creating Breaks 57

Part 1. Getting Started. Chapter 1 Creating a Simple Report 3. Chapter 2 PROC REPORT: An Introduction 13. Chapter 3 Creating Breaks 57 Part 1 Getting Started Chapter 1 Creating a Simple Report 3 Chapter 2 PROC REPORT: An Introduction 13 Chapter 3 Creating Breaks 57 Chapter 4 Only in the LISTING Destination 75 Chapter 5 Creating and Modifying

More information

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

Paper An Automated Reporting Macro to Create Cell Index An Enhanced Revisit. Shi-Tao Yeh, GlaxoSmithKline, King of Prussia, PA ABSTRACT Paper 236-28 An Automated Reporting Macro to Create Cell Index An Enhanced Revisit When generating tables from SAS PROC TABULATE or PROC REPORT to summarize data, sometimes it is necessary to

More information

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!  We offer free update service for one year PASS4TEST IT Certification Guaranteed, The Easy Way! \ http://www.pass4test.com We offer free update service for one year Exam : A00-201 Title : SAS base programming exam Vendors : SASInstitute Version

More information

Go Ahead and _BREAK_-down: Advanced COMPUTE Block Examples

Go Ahead and _BREAK_-down: Advanced COMPUTE Block Examples Paper SAS431-2017 Go Ahead and _BREAK_-down: Advanced COMPUTE Block Examples Cynthia Zender, SAS Institute Inc. ABSTRACT When you look at examples of the REPORT procedure, you see code that tests _BREAK_

More information

Developing Data-Driven SAS Programs Using Proc Contents

Developing Data-Driven SAS Programs Using Proc Contents Developing Data-Driven SAS Programs Using Proc Contents Robert W. Graebner, Quintiles, Inc., Kansas City, MO ABSTRACT It is often desirable to write SAS programs that adapt to different data set structures

More information

Using SAS to Analyze CYP-C Data: Introduction to Procedures. Overview

Using SAS to Analyze CYP-C Data: Introduction to Procedures. Overview Using SAS to Analyze CYP-C Data: Introduction to Procedures CYP-C Research Champion Webinar July 14, 2017 Jason D. Pole, PhD Overview SAS overview revisited Introduction to SAS Procedures PROC FREQ PROC

More information

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint

Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint PharmaSUG 2018 - Paper DV-01 Square Peg, Square Hole Getting Tables to Fit on Slides in the ODS Destination for PowerPoint Jane Eslinger, SAS Institute Inc. ABSTRACT An output table is a square. A slide

More information

Justina M. Flavin, Synteract, Inc.

Justina M. Flavin, Synteract, Inc. Using PROC REPORT to Summarize Clinical Safety Data Justina M. Flavin, Synteract, Inc. ABSTRACT By using the summary and display features available In PROC REPORT, the amount of code needed to generate

More information

Introduction to PROC SQL

Introduction to PROC SQL Introduction to PROC SQL Steven First, Systems Seminar Consultants, Madison, WI ABSTRACT PROC SQL is a powerful Base SAS Procedure that combines the functionality of DATA and PROC steps into a single step.

More information

Validation Summary using SYSINFO

Validation Summary using SYSINFO Validation Summary using SYSINFO Srinivas Vanam Mahipal Vanam Shravani Vanam Percept Pharma Services, Bridgewater, NJ ABSTRACT This paper presents a macro that produces a Validation Summary using SYSINFO

More information

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

An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio PharmaSUG 2012 - Paper CC12 An Efficient Method to Create Titles for Multiple Clinical Reports Using Proc Format within A Do Loop Youying Yu, PharmaNet/i3, West Chester, Ohio ABSTRACT Do you know how to

More information

The Beauty of OUT2HTM with Proc Report David Steves, Suntrust Banks Inc., Atlanta, Georgia U.S.A.

The Beauty of OUT2HTM with Proc Report David Steves, Suntrust Banks Inc., Atlanta, Georgia U.S.A. Paper P316 The Beauty of OUT2HTM with Proc Report David Steves, Suntrust Banks Inc., Atlanta, Georgia U.S.A. ABSTRACT Using Proc Reports to Create HTML pages via % OUT2HTM is very easy. This paper describes

More information

Using the Set Operators. Copyright 2006, Oracle. All rights reserved.

Using the Set Operators. Copyright 2006, Oracle. All rights reserved. Using the Set Operators Objectives After completing this lesson, you should be able to do the following: Describe set operators Use a set operator to combine multiple queries into a single query Control

More information

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA

Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA SESUG 2012 Paper HW-01 Getting Up to Speed with PROC REPORT Kimberly LeBouton, K.J.L. Computing, Rossmoor, CA ABSTRACT Learning the basics of PROC REPORT can help the new SAS user avoid hours of headaches.

More information

BY S NOTSORTED OPTION Karuna Samudral, Octagon Research Solutions, Inc., Wayne, PA Gregory M. Giddings, Centocor R&D Inc.

BY S NOTSORTED OPTION Karuna Samudral, Octagon Research Solutions, Inc., Wayne, PA Gregory M. Giddings, Centocor R&D Inc. ABSTRACT BY S NOTSORTED OPTION Karuna Samudral, Octagon Research Solutions, Inc., Wayne, PA Gregory M. Giddings, Centocor R&D Inc., Malvern, PA What if the usual sort and usual group processing would eliminate

More information

Paper DB2 table. For a simple read of a table, SQL and DATA step operate with similar efficiency.

Paper DB2 table. For a simple read of a table, SQL and DATA step operate with similar efficiency. Paper 76-28 Comparative Efficiency of SQL and Base Code When Reading from Database Tables and Existing Data Sets Steven Feder, Federal Reserve Board, Washington, D.C. ABSTRACT In this paper we compare

More information

SAS/ETS 13.2 User s Guide. The COMPUTAB Procedure

SAS/ETS 13.2 User s Guide. The COMPUTAB Procedure SAS/ETS 13.2 User s Guide The COMPUTAB Procedure This document is an individual chapter from SAS/ETS 13.2 User s Guide. The correct bibliographic citation for the complete manual is as follows: SAS Institute

More information

USING DATA TO SET MACRO PARAMETERS

USING DATA TO SET MACRO PARAMETERS USING DATA TO SET MACRO PARAMETERS UPDATE A PREVIOUS EXAMPLE %macro report(regs=); %let r=1; %let region=%scan(&regs,&r); %do %until(&region eq ); options nodate pageno=1; ods pdf file="&region..pdf";

More information

More with SQL Queries. Advanced SAS Programming

More with SQL Queries. Advanced SAS Programming More with SQL Queries Advanced SAS Programming Some PROC SQL Options Options available in the PROC SQL statement FEEDBACK(NOFEEDBACK): provides more detailed information in the SAS log. FLOW(noflow):

More information

Formatting Highly Detailed Reports: Eye-Friendly, Insight-Facilitating

Formatting Highly Detailed Reports: Eye-Friendly, Insight-Facilitating L.Fine Formatting Highly Detailed Reports 1 Formatting Highly Detailed Reports: Eye-Friendly, Insight-Facilitating Lisa Fine, United BioSource Corporation Introduction Consider a highly detailed report

More information

Advanced PROC REPORT: Getting Your Tables Connected Using Links

Advanced PROC REPORT: Getting Your Tables Connected Using Links Advanced PROC REPORT: Getting Your Tables Connected Using Links Arthur L. Carpenter California Occidental Consultants ABSTRACT Gone are the days of strictly paper reports. Increasingly we are being asked

More information

The REPORT Procedure and ODS Destination for Microsoft Excel: The Smarter, Faster Way to Create First-Rate Excel Reports

The REPORT Procedure and ODS Destination for Microsoft Excel: The Smarter, Faster Way to Create First-Rate Excel Reports The REPORT Procedure and ODS Destination for Microsoft Excel: The Smarter, Faster Way to Create First-Rate Excel Reports Jane Eslinger, SAS Institute Inc. PROGRAMMERS BOSSES Current Process Develop SAS

More information

Using V9 ODS LAYOUT to Simplify Generation of Individual Case Summaries Ling Y. Chen, Rho, Inc., Newton, MA

Using V9 ODS LAYOUT to Simplify Generation of Individual Case Summaries Ling Y. Chen, Rho, Inc., Newton, MA Paper PO02 Using V9 ODS LAYOUT to Simplify Generation of Individual Case Summaries Ling Y. Chen, Rho, Inc., Newton, MA ABSTRACT Up until now, individual case summaries involve complicated data _null_ coding

More information

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

Using PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO Using PROC SQL to Calculate FIRSTOBS David C. Tabano, Kaiser Permanente, Denver, CO ABSTRACT The power of SAS programming can at times be greatly improved using PROC SQL statements for formatting and manipulating

More information

SAS Programming Basics

SAS Programming Basics SAS Programming Basics SAS Programs SAS Programs consist of three major components: Global statements Procedures Data steps SAS Programs Global Statements Procedures Data Step Notes Data steps and procedures

More information

Lecture 1 Getting Started with SAS

Lecture 1 Getting Started with SAS SAS for Data Management, Analysis, and Reporting Lecture 1 Getting Started with SAS Portions reproduced with permission of SAS Institute Inc., Cary, NC, USA Goals of the course To provide skills required

More information

BEYOND FORMAT BASICS 1

BEYOND FORMAT BASICS 1 BEYOND FORMAT BASICS 1 CNTLIN DATA SETS...LABELING VALUES OF VARIABLE One common use of a format in SAS is to assign labels to values of a variable. The rules for creating a format with PROC FORMAT are

More information

Fly over, drill down, and explore

Fly over, drill down, and explore ABSTRACT Paper 79-2013 Fly over, drill down, and explore Suzanne Brown, HealthInsight New Mexico, Albuquerque, NM Data often have a spatial dimension, whether it is a five-year financial plan and annual

More information

STEP 1 - /*******************************/ /* Manipulate the data files */ /*******************************/ <<SAS DATA statements>>

STEP 1 - /*******************************/ /* Manipulate the data files */ /*******************************/ <<SAS DATA statements>> Generalized Report Programming Techniques Using Data-Driven SAS Code Kathy Hardis Fraeman, A.K. Analytic Programming, L.L.C., Olney, MD Karen G. Malley, Malley Research Programming, Inc., Rockville, MD

More information

EXAMPLE 2: INTRODUCTION TO SAS AND SOME NOTES ON HOUSEKEEPING PART II - MATCHING DATA FROM RESPONDENTS AT 2 WAVES INTO WIDE FORMAT

EXAMPLE 2: INTRODUCTION TO SAS AND SOME NOTES ON HOUSEKEEPING PART II - MATCHING DATA FROM RESPONDENTS AT 2 WAVES INTO WIDE FORMAT EXAMPLE 2: PART I - INTRODUCTION TO SAS AND SOME NOTES ON HOUSEKEEPING PART II - MATCHING DATA FROM RESPONDENTS AT 2 WAVES INTO WIDE FORMAT USING THESE WORKSHEETS For each of the worksheets you have a

More information

EXST SAS Lab Lab #6: More DATA STEP tasks

EXST SAS Lab Lab #6: More DATA STEP tasks EXST SAS Lab Lab #6: More DATA STEP tasks Objectives 1. Working from an current folder 2. Naming the HTML output data file 3. Dealing with multiple observations on an input line 4. Creating two SAS work

More information

Chapter 6: Modifying and Combining Data Sets

Chapter 6: Modifying and Combining Data Sets Chapter 6: Modifying and Combining Data Sets The SET statement is a powerful statement in the DATA step. Its main use is to read in a previously created SAS data set which can be modified and saved as

More information

How To Get Ten Pounds Of Data Into A Five Pound Can Using Flyover Technique In HTML Output

How To Get Ten Pounds Of Data Into A Five Pound Can Using Flyover Technique In HTML Output Paper TT15 How To Get Ten Pounds Of Data Into A Five Pound Can Using Flyover Technique In HTML Output Daniel K. Downing, CaremarkPCS, Scottsdale, AZ ABSTRACT When delivering results today, it is more and

More information

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

A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment A Practical and Efficient Approach in Generating AE (Adverse Events) Tables within a Clinical Study Environment Abstract Jiannan Hu Vertex Pharmaceuticals, Inc. When a clinical trial is at the stage of

More information

proc print data=account; <insert statement here> run;

proc print data=account; <insert statement here> run; Statistics 6250 Name: Fall 2012 (print: first last ) Prof. Fan NetID #: Midterm Three Instructions: This is an in-class and open book midterm. You must write your answers on the provide spaces. Give concise

More information

PROC JACK REG - A SAS~ PROCEDURE FOR JACKKNIFE REGRESSION Panayiotis Hambi, West Virginia University

PROC JACK REG - A SAS~ PROCEDURE FOR JACKKNIFE REGRESSION Panayiotis Hambi, West Virginia University ABSTRACT PROC JACK REG - A SAS~ PROCEDURE FOR JACKKNIFE REGRESSION Panayiotis Hambi, West Virginia University Daniel M. Chl1ko, West Virginia UniverSity Gerry Hobos, West Virginia University PROC JACKREG

More information

Generating Customized Analytical Reports from SAS Procedure Output Brinda Bhaskar and Kennan Murray, RTI International

Generating Customized Analytical Reports from SAS Procedure Output Brinda Bhaskar and Kennan Murray, RTI International Abstract Generating Customized Analytical Reports from SAS Procedure Output Brinda Bhaskar and Kennan Murray, RTI International SAS has many powerful features, including MACRO facilities, procedures such

More information

Basic SQL Processing Prepared by Destiny Corporation

Basic SQL Processing Prepared by Destiny Corporation Basic SQL Processing Prepared by Destiny Corporation SQLStatements PROC SQl consists often statements: from saved.computeg- l.select 2.vAlIDATE 3.DESCRIBE 4.CREATE S.DROP a.update 7.INSERT B.DElETE 9.ALTER

More information

Introduction to the SAS Macro Facility

Introduction to the SAS Macro Facility Introduction to the SAS Macro Facility Uses for SAS Macros The macro language allows for programs that are dynamic capable of selfmodification. The major components of the macro language include: Macro

More information

Get SAS sy with PROC SQL Amie Bissonett, Pharmanet/i3, Minneapolis, MN

Get SAS sy with PROC SQL Amie Bissonett, Pharmanet/i3, Minneapolis, MN PharmaSUG 2012 - Paper TF07 Get SAS sy with PROC SQL Amie Bissonett, Pharmanet/i3, Minneapolis, MN ABSTRACT As a data analyst for genetic clinical research, I was often working with familial data connecting

More information

Data Quality Review for Missing Values and Outliers

Data Quality Review for Missing Values and Outliers Paper number: PH03 Data Quality Review for Missing Values and Outliers Ying Guo, i3, Indianapolis, IN Bradford J. Danner, i3, Lincoln, NE ABSTRACT Before performing any analysis on a dataset, it is often

More information

The Proc Transpose Cookbook

The Proc Transpose Cookbook ABSTRACT PharmaSUG 2017 - Paper TT13 The Proc Transpose Cookbook Douglas Zirbel, Wells Fargo and Co. Proc TRANSPOSE rearranges columns and rows of SAS datasets, but its documentation and behavior can be

More information

Chapter 7 File Access. Chapter Table of Contents

Chapter 7 File Access. Chapter Table of Contents Chapter 7 File Access Chapter Table of Contents OVERVIEW...105 REFERRING TO AN EXTERNAL FILE...105 TypesofExternalFiles...106 READING FROM AN EXTERNAL FILE...107 UsingtheINFILEStatement...107 UsingtheINPUTStatement...108

More information

Automated Macros to Extract Data from the National (Nationwide) Inpatient Sample (NIS)

Automated Macros to Extract Data from the National (Nationwide) Inpatient Sample (NIS) Paper 3327-2015 Automated Macros to Extract Data from the National (Nationwide) Inpatient Sample (NIS) Ravi Gaddameedi, California State University, Eastbay, CA; Usha Kreaden, Intuitive Surgical, Sunnyvale,

More information

Creating Macro Calls using Proc Freq

Creating Macro Calls using Proc Freq Creating Macro Calls using Proc Freq, Educational Testing Service, Princeton, NJ ABSTRACT Imagine you were asked to get a series of statistics/tables for each country in the world. You have the data, but

More information

Are You Missing Out? Working with Missing Values to Make the Most of What is not There

Are You Missing Out? Working with Missing Values to Make the Most of What is not There Are You Missing Out? Working with Missing Values to Make the Most of What is not There Arthur L. Carpenter, California Occidental Consultants ABSTRACT Everyone uses and works with missing values, however

More information

INTRODUCTION to SAS STATISTICAL PACKAGE LAB 3

INTRODUCTION to SAS STATISTICAL PACKAGE LAB 3 Topics: Data step Subsetting Concatenation and Merging Reference: Little SAS Book - Chapter 5, Section 3.6 and 2.2 Online documentation Exercise I LAB EXERCISE The following is a lab exercise to give you

More information

SAS Application Development Using Windows RAD Software for Front End

SAS Application Development Using Windows RAD Software for Front End Applications Development SAS Application Development Using Windows RAD Software for Front End Zhuan (John) Xu Blue Cross Blue Shield ofiowa & Big Creek Software, Des Moines, IA Abstract This paper presents

More information

Paper DM07. An Animated Guide: Comparing Files without Proc Compare Alejandro Jaramillo (Data Means Corp) and Russ Lavery contractor

Paper DM07. An Animated Guide: Comparing Files without Proc Compare Alejandro Jaramillo (Data Means Corp) and Russ Lavery contractor Paper DM07 An Animated Guide: Comparing Files without Proc Compare Alejandro Jaramillo (Data Means Corp) and Russ Lavery contractor ABSTRACT This paper provides an easy to understand SAS-based programmed

More information

TIPS FROM THE TRENCHES

TIPS FROM THE TRENCHES TIPS FROM THE TRENCHES Christopher Bost MDRC SAS Users Group October 1, 2008 Recent user questions 2 How can I print long character values? How can I EXPORT formatted values to Excel? How can I check for

More information

PROC SUMMARY AND PROC FORMAT: A WINNING COMBINATION

PROC SUMMARY AND PROC FORMAT: A WINNING COMBINATION PROC SUMMARY AND PROC FORMAT: A WINNING COMBINATION Alan Dickson - Consultant Introduction: Is this scenario at all familiar to you? Your users want a report with multiple levels of subtotals and grand

More information

An Introduction to PROC SQL. David Beam Systems Seminar Consultants, Inc. - Madison, WI

An Introduction to PROC SQL. David Beam Systems Seminar Consultants, Inc. - Madison, WI An Introduction to PROC SQL David Beam Systems Seminar Consultants, Inc. - Madison, WI Abstract PROC SQL is a powerful Base SAS PROC which combines the functionality of the DATA and PROC Steps into a single

More information

SAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables

SAS seminar. The little SAS book Chapters 3 & 4. April 15, Åsa Klint. By LD Delwiche and SJ Slaughter. 3.1 Creating and Redefining variables SAS seminar April 15, 2003 Åsa Klint The little SAS book Chapters 3 & 4 By LD Delwiche and SJ Slaughter Data step - read and modify data - create a new dataset - performs actions on rows Proc step - use

More information

Interleaving a Dataset with Itself: How and Why

Interleaving a Dataset with Itself: How and Why cc002 Interleaving a Dataset with Itself: How and Why Howard Schreier, U.S. Dept. of Commerce, Washington DC ABSTRACT When two or more SAS datasets are combined by means of a SET statement and an accompanying

More information

Indenting with Style

Indenting with Style ABSTRACT Indenting with Style Bill Coar, Axio Research, Seattle, WA Within the pharmaceutical industry, many SAS programmers rely heavily on Proc Report. While it is used extensively for summary tables

More information

A Few Quick and Efficient Ways to Compare Data

A Few Quick and Efficient Ways to Compare Data A Few Quick and Efficient Ways to Compare Data Abraham Pulavarti, ICON Clinical Research, North Wales, PA ABSTRACT In the fast paced environment of a clinical research organization, a SAS programmer has

More information

Paper # Jazz it up a Little with Formats. Brian Bee, The Knowledge Warehouse Ltd

Paper # Jazz it up a Little with Formats. Brian Bee, The Knowledge Warehouse Ltd Paper #1495-2014 Jazz it up a Little with Formats Brian Bee, The Knowledge Warehouse Ltd Abstract Formats are an often under-valued tool in the SAS toolbox. They can be used in just about all domains to

More information

Processing SAS Data Sets

Processing SAS Data Sets Statistical Data Analysis 1 Processing SAS Data Sets Namhyoung Kim Dept. of Applied Statistics Gachon University nhkim@gachon.ac.kr 1 Using OUT Dataset OUTPUT Statement OUTPUT

More information

Chapter 10 C Structures, Unions, Bit Manipulations

Chapter 10 C Structures, Unions, Bit Manipulations Chapter 10 C Structures, Unions, Bit Manipulations Skipped! Skipped! and Enumerations Skipped! Page 416 In programming languages, Arrays (Chapter 6) allows programmers to group elements of the same type

More information

USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST

USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST USING SAS SOFTWARE TO COMPARE STRINGS OF VOLSERS IN A JCL JOB AND A TSO CLIST RANDALL M NICHOLS, Mississippi Dept of ITS, Jackson, MS ABSTRACT The TRANSLATE function of SAS can be used to strip out punctuation

More information

DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017

DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017 DSCI 325: Handout 9 Sorting and Options for Printing Data in SAS Spring 2017 There are a handful of statements (TITLE, FOOTNOTE, WHERE, BY, etc.) that can be used in a wide variety of procedures. For example,

More information

22S:172. Duplicates. may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated

22S:172. Duplicates. may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated 22S:172 1 2 Duplicates Data Cleaning involving duplicate IDs and duplicate records may need to check for either duplicate ID codes or duplicate observations duplicate observations should just be eliminated

More information

Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny

Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Planting Your Rows: Using SAS Formats to Make the Generation of Zero- Filled Rows in Tables Less Thorny Kathy Hardis Fraeman, United BioSource Corporation, Bethesda, MD ABSTRACT Often tables or summary

More information

Shell Start-up and Configuration Files

Shell Start-up and Configuration Files ULI101 Week 10 Lesson Overview Shell Start-up and Configuration Files Shell History Alias Statement Shell Variables Introduction to Shell Scripting Positional Parameters echo and read Commands if and test

More information

PDF Multi-Level Bookmarks via SAS

PDF Multi-Level Bookmarks via SAS Paper TS04 PDF Multi-Level Bookmarks via SAS Steve Griffiths, GlaxoSmithKline, Stockley Park, UK ABSTRACT Within the GlaxoSmithKline Oncology team we recently experienced an issue within our patient profile

More information

Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI

Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI Get Going with PROC SQL Richard Severino, Convergence CT, Honolulu, HI ABSTRACT PROC SQL is the SAS System s implementation of Structured Query Language (SQL). PROC SQL can be used to retrieve or combine/merge

More information

ACCESS Procedure Reference

ACCESS Procedure Reference 59 CHAPTER 5 ACCESS Procedure Reference Introduction 59 Case Sensitivity in the ACCESS Procedure 60 ACCESS Procedure 60 Description 61 PROC ACCESS Statement Options 62 Options 62 SAS System Passwords for

More information

work.test temp.test sasuser.test test

work.test temp.test sasuser.test test DSCI 325 Midterm Practice Test Spring 2017 Name: 1. Consider the following four names used to create a SAS data set: work.test temp.test sasuser.test test How many of these will be stored as permanent

More information

ZERO MY HERO! Getting those zeroes on your PROC REPORT or PROC TABULATE tables!!

ZERO MY HERO! Getting those zeroes on your PROC REPORT or PROC TABULATE tables!! ZERO MY HERO! Getting those zeroes on your PROC REPORT or PROC TABULATE tables!! Anna Vincent Research Specialist Data Management Center for Health Statistics Texas Dept. of State Health Services Here

More information

Exam Name: SAS Base Programming for SAS (r) 9 Exam Type: SAS Exam Code: A Total Questions: 127

Exam Name: SAS Base Programming for SAS (r) 9 Exam Type: SAS Exam Code: A Total Questions: 127 Question: 1 The SAS data set SASUSER.HOUSES contains a variable PRICE which has been assigned a permanent label of Asking Price. Which SAS program temporarily replaces the label Asking Price with the label

More information

An introduction to classification and regression trees with PROC HPSPLIT Peter L. Flom Peter Flom Consulting, LLC

An introduction to classification and regression trees with PROC HPSPLIT Peter L. Flom Peter Flom Consulting, LLC Paper AA-42 An introduction to classification and regression trees with PROC HPSPLIT Peter L. Flom Peter Flom Consulting, LLC ABSTRACT Classification and regression trees are extremely intuitive to read

More information

17. Reading free-format data. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 386

17. Reading free-format data. GIORGIO RUSSOLILLO - Cours de prépara)on à la cer)fica)on SAS «Base Programming» 386 17. Reading free-format data 386 Reading free format data: The list input A raw dataset is free-format when it is not arranged in fixed fields. -> Fields are separated by a delimiter List input allows

More information

Statistics, Data Analysis & Econometrics

Statistics, Data Analysis & Econometrics ST009 PROC MI as the Basis for a Macro for the Study of Patterns of Missing Data Carl E. Pierchala, National Highway Traffic Safety Administration, Washington ABSTRACT The study of missing data patterns

More information

SYSTEM 2000 Essentials

SYSTEM 2000 Essentials 7 CHAPTER 2 SYSTEM 2000 Essentials Introduction 7 SYSTEM 2000 Software 8 SYSTEM 2000 Databases 8 Database Name 9 Labeling Data 9 Grouping Data 10 Establishing Relationships between Schema Records 10 Logical

More information

OS/390 SAS/MXG Computer Performance Reports in HTML Format

OS/390 SAS/MXG Computer Performance Reports in HTML Format Paper 153-29 E-Mail OS/390 SAS/MXG Computer Performance Reports in HTML Format ABSTRACT Neal Musitano Jr. Department of Veterans Affairs Information Technology Center Philadelphia, Pennsylvania This paper

More information

Using Recursion for More Convenient Macros

Using Recursion for More Convenient Macros Paper BB-04 Using Recursion for More Convenient Macros Nate Derby, Stakana Analytics, Seattle, WA ABSTRACT There are times when a macro needs to alternatively be applied to either one value or a list of

More information

Example1D.1.sas. * Procedures : ; * 1. print to show the dataset. ;

Example1D.1.sas. * Procedures : ; * 1. print to show the dataset. ; Example1D.1.sas * SAS example program 1D.1 ; * 1. Create a dataset called prob from the following data: ; * age prob lb ub ; * 24.25.20.31 ; * 36.26.21.32 ; * 48.28.24.33 ; * 60.31.28.36 ; * 72.35.32.39

More information

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances

SQL Queries. COSC 304 Introduction to Database Systems SQL. Example Relations. SQL and Relational Algebra. Example Relation Instances COSC 304 Introduction to Database Systems SQL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Queries Querying with SQL is performed using a SELECT statement. The general

More information

Principles of Biostatistics and Data Analysis PHP 2510 Lab2

Principles of Biostatistics and Data Analysis PHP 2510 Lab2 Goals for Lab2: Familiarization with Do-file Editor (two important features: reproducible and analysis) Reviewing commands for summary statistics Visual depiction of data- bar chart and histograms Stata

More information

Doing Math: Scientific Notation Scientific notation is a way to show (and do math with) very small or very large numbers b 10 c

Doing Math: Scientific Notation Scientific notation is a way to show (and do math with) very small or very large numbers b 10 c Doing Math: Scientific Notation Scientific notation is a way to show (and do math with) very small or very large numbers b 10 c b = a decimal number between 1.0 and 9.99... c =anexponentof10 Example: 1.53

More information

Responding to Tracking Items

Responding to Tracking Items Responding to Tracking Items Flags and Referrals are intended to prompt students to take some action. Assigned advisors are included in notice of these flags because they are a key resource to students

More information