PROC_CODEBOOK: An Automated, General Purpose Codebook Generator

Slides:



Advertisements
Similar presentations
Creating Data Entry Screens in Epi Info
Advertisements

Axio Research E-Compare A Tool for Data Review Bill Coar.
The INFILE Statement Reading files into SAS from an outside source: A Very Useful Tool!
Examples from SAS Functions by Example Ron Cody
1 SAS Formats and SAS Macro Language HRP223 – 2011 November 9 th, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
Salesforce.com Web to Leads. Unit Name Web to Leads A web to lead provides users the ability to gather information from their website visitors which automatically.
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
Into to SAS ®. 2 List the components of a SAS program. Open an existing SAS program and run it. Objectives.
Introduction to SAS Lecture 2 Brian Healy.
Creating SAS® Data Sets
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
1 Chapter 5: Creating Summarized Output 5.1 Generating Summary Statistics 5.2 Creating a Summary Report with the Summary Tables Task 5.3 Creating and Applying.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS ESSENTIALS -- Elliott & Woodward1.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 Experimental Statistics - week 4 Chapter 8: 1-factor ANOVA models Using SAS.
HPR Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
Key Data Management Tasks in Stata
BMTRY 789 Introduction to SAS Programming Lecturer: Annie N. Simpson, MSc.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
1 PhUSE 2011 Missing Values in SAS Magnus Mengelbier Director.
Bringing Data into SAS From Menu: –File –Import Data –Spreadsheet example first Pick file by browsing Select Library and Member (we will talk about this.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
01/20151 EPI 5344: Survival Analysis in Epidemiology SAS code and output February 24, 2015 Dr. N. Birkett, School of Epidemiology, Public Health & Preventive.
BLC Training for Managers Presented By: Banner Health Learning & Development Team.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
WHAT IS A DATABASE? A DATABASE IS A COLLECTION OF DATA RELATED TO A PARTICULAR TOPIC OR PURPOSE OR TO PUT IT SIMPLY A GENERAL PURPOSE CONTAINER FOR STORING.
IBC233 Lecture 2 Updated Winter 2008 Agenda Test next Week – Jan 23 ISeries Architecture CL (Control Language) Library Lists Operations Navigator.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
Chapter 17: Formatting Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Writing and Reading XML files with SAS (Statistical Analysis System) What is SAS ? SAS Institute (or SAS, pronounced "sass") is an American developer of.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
An Introduction Katherine Nicholas & Liqiong Fan.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
How to sort the “Order Information report” from the service “Print Acquisitions Records acq-03” Yoel Kortick.
Davisware GlobalEdge 2008 Payroll Main Menu Time Entry and Payroll Processing.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
Copyright © 2004, SAS Institute Inc. All rights reserved. SASHELP Datasets A real life example Barb Crowther SAS Consultant October 22, 2004.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
17b.Accessing Data: Manipulating Variables in SAS ®
BMTRY 789 Lecture 6: Proc Sort, Random Number Generators, and Do Loops Readings – Chapters 5 & 6 Lab Problem - Brain Teaser Homework Due – HW 2 Homework.
Chapter 21: Controlling Data Storage Space 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
B Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Working with PDF and eText Templates.
Using the District Accounting System A District Governor’s View.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Online Programming| Online Training| Real Time Projects | Certifications |Online Classes| Corporate Training |Jobs| CONTACT US: STANSYS SOFTWARE SOLUTIONS.
SAS Certification Prep Guide Chapter 7 Creating and Applying User-Defined Formats.
Copyright 2009 The Little Engine That Could: Using EXCEL LIBNAME Engine Options to Enhance Data Transfers between SAS® and Microsoft® Excel Files William.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 14 & 19 By Tasha Chapman, Oregon Health Authority.
Working Efficiently with Large SAS® Datasets Vishal Jain Senior Programmer.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
03/20161 EPI 5344: Survival Analysis in Epidemiology Estimating S(t) from Cox models March 29, 2016 Dr. N. Birkett, School of Epidemiology, Public Health.
Better Metadata Through SAS® II: %SYSFUNC, PROC DATASETS, and Dictionary Tables.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Using the District Accounting System Part 1: System Navigation and Reporting.
Creative Create Lists Elizabeth B. Thomsen Member Services Manager
Chapter 7 Text Input/Output Objectives
SAS Programming Introduction to SAS.
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Introduction to SAS A SAS program is a list of SAS statements executed in order Every SAS statement ends with a semicolon! SAS statements can be in caps.
Suppose I want to add all the even integers from 1 to 100 (inclusive)
Stata Basic Course Lab 2.
Tips and Tricks for Using Macros to Automate SAS Reporting.
Presentation transcript:

PROC_CODEBOOK: An Automated, General Purpose Codebook Generator Kim Chantala, email: kim_chantala@unc.edu Dept of Health Behavior & Health Education Jim Terry email: jim_terry@unc.edu Carolina Population Center University of North Carolina at Chapel Hill

PROC_CODEBOOK.SAS SAS macro program that is simple to use User provides: titles for the codebook the file organization SAS data set with labels and formats . Output is a comprehensive, well formatted, easy to read codebook.

Sample Code %include 'C:\My_project\HWT_short_formats.sas'; %include ' C:\My_project\proc_codebook.sas'; libname here 'C:\My_project'; title1 'CODEBOOK FOR WAY TO HEALTH BASELINE HEIGHT/WEIGHT DATA'; footnote 'Created by: hwt_base_codebook.sas'; %let organization=One Record per Participant (ID); %proc_codebook(lib=here, file1=hwt_base, fmtlib=work.formats, pdffile=hwt_base_codebook.pdf); run;

PDF file created by PROC_CODEBOOK

USING PROC_CODEBOOK.SAS Create labels for all variables. Data set must contain at least one formatted categorical variable and two numeric variables. Assign FORMATs to all categorical variables. Standard formats should be used that assign only one value or a range of values to a unique value label. No testing has been done using hybrid formats or formats with multi-value labels. Include a data set label on the SAS data file. By default, the codebook is ordered by Variable Name.

ORDERING VARIABLES IN THE CODEBOOK Create a simple two variable file called work.order before you call the macro. NAME: a 32 character field with your variable name in UPPER CASE. ORDER: a numeric field with the order you want the variables to print. Example data step creating a work.order data set: data order; length name $ 32; name = "T1 "; ORDER = 1; OUTPUT; name = "HHID09"; ORDER = 2; OUTPUT; name = "LINE09"; ORDER = 3; OUTPUT; name = "H1D "; ORDER = 4; OUTPUT; run;

TITLES AND FOOTNOTES TITLE1, TITLE2 and all FOOTNOTES are specified by user. PROC_CODEBOOK creates the following titles: TITLE4 lists the number of observations in data set. TITLE5 lists the number of variables in the data set. TITLE6 lists the organization of the data set and is specified in a global macro variable by the user: %let organization=One Record per Participant(ID);

PROC_CODEBOOK syntax %proc_codebook(lib=libname, file1=SAS_dataset, fmtlib=work.formats, pdffile=codebook_file.pdf, include_warn=NO);

The macro variables Required Variables: Optional Variables: LIB = library for SAS data set (see FILE1 variable) FILE1 = SAS data set used to create the codebook FMTLIB = 2-level name of format library PDFFILE = name of PDF file for the codebook Optional Variables: INCLUDE_WARN= flag to control printing of WARNING messages: * YES=prints warnings in codebook (default), * NO (or Any other text)=warnings printed only in LOG file.

Warning Messages Categories of formats not used by a variable Variables that have missing data for all observations Variables that are constant

Tips on embellishing your codebook: Add a LOGO to the codebook %let organization=One Record per ORGID*INJURY_DATE*INJURY_TYPE; ods escapechar='~'; title1 j=c '~S={preimage="H:\datalys\Logo\datalys_color_logo_final.JPG"}'; title2 j=l "CODEBOOK: Women's Volleyball Injury Data Set 2004-05 to 2008-09"; footnote1 j=l 'SAS data set: injwvb0409.sas7bdat'; footnote2 j=l 'Created by H:\datalys\Chantala\Data Dec2009\injwvb0409.sas'; footnote3 'Listed Format assignment not always stored with permanent SAS data set'; %proc_codebook(lib=work, file1=injwvb0409, fmtlib=work.formats, pdffile=C:\My_project\injwvb0409_codebook.pdf, include_warn=NO);

PDF file created by PROC_CODEBOOK:

SAS CODE & DEMONSTRATION http://www.cpc.unc.edu/research/tools/data_analysis/proc_codebook