SlideShare a Scribd company logo
1 of 13
PROC_CODEBOOK: 
An Automated, General Purpose 
Codebook Generator 
Kim Chantala, 
email: kim_chantala@unc.edu 
Sheps Center for Health Services Research 
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_projectHWT_short_formats.sas'; 
%include ' C:My_projectproc_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: 
– 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:datalysLogodatalys_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:datalysChantalaData Dec2009injwvb0409.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_projectinjwvb0409_codebook.pdf, 
include_warn=NO);
PDF file created by PROC_CODEBOOK:
SAS CODE 
The SAS codebook macro & documentation can be downloaded from the 
following location: 
http://www.cpc.unc.edu/research/tools/data_analysis/proc_codebook

More Related Content

Viewers also liked

Networking 2014 UNC Chapel Hill CTC Retreat
Networking 2014 UNC Chapel Hill CTC RetreatNetworking 2014 UNC Chapel Hill CTC Retreat
Networking 2014 UNC Chapel Hill CTC RetreatJonathan Pletzke
 
2014 ctc retreat sccm discussion alan forrest
2014 ctc retreat sccm discussion alan forrest2014 ctc retreat sccm discussion alan forrest
2014 ctc retreat sccm discussion alan forrestJonathan Pletzke
 
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...Jonathan Pletzke
 
Ctc presentation tablet-based-data-collection20141027
Ctc presentation tablet-based-data-collection20141027Ctc presentation tablet-based-data-collection20141027
Ctc presentation tablet-based-data-collection20141027Jonathan Pletzke
 
İhr 505 reklam
İhr 505 reklamİhr 505 reklam
İhr 505 reklammeleksema
 
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5Jonathan Pletzke
 
UNC Chapel Hill 2014 CTC Retreat - unc transition to voice over ip
UNC Chapel Hill 2014 CTC Retreat -   unc transition to voice over ipUNC Chapel Hill 2014 CTC Retreat -   unc transition to voice over ip
UNC Chapel Hill 2014 CTC Retreat - unc transition to voice over ipJonathan Pletzke
 
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business Intelligence
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business IntelligenceUNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business Intelligence
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business IntelligenceJonathan Pletzke
 
UNC Chapel Hill 2014 CTC Retreat - Creating epub e books
UNC Chapel Hill 2014 CTC Retreat - Creating epub e booksUNC Chapel Hill 2014 CTC Retreat - Creating epub e books
UNC Chapel Hill 2014 CTC Retreat - Creating epub e booksJonathan Pletzke
 
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset Managment
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset ManagmentUNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset Managment
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset ManagmentJonathan Pletzke
 
CIO/CTO Ctc presentation fall 2014
CIO/CTO Ctc presentation fall 2014CIO/CTO Ctc presentation fall 2014
CIO/CTO Ctc presentation fall 2014Jonathan Pletzke
 

Viewers also liked (11)

Networking 2014 UNC Chapel Hill CTC Retreat
Networking 2014 UNC Chapel Hill CTC RetreatNetworking 2014 UNC Chapel Hill CTC Retreat
Networking 2014 UNC Chapel Hill CTC Retreat
 
2014 ctc retreat sccm discussion alan forrest
2014 ctc retreat sccm discussion alan forrest2014 ctc retreat sccm discussion alan forrest
2014 ctc retreat sccm discussion alan forrest
 
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...
UNC Chapel Hill 2014 CTC Retreat - Carolina Cloudapps / RedHat OpenShift Ente...
 
Ctc presentation tablet-based-data-collection20141027
Ctc presentation tablet-based-data-collection20141027Ctc presentation tablet-based-data-collection20141027
Ctc presentation tablet-based-data-collection20141027
 
İhr 505 reklam
İhr 505 reklamİhr 505 reklam
İhr 505 reklam
 
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5
UNC Chapel Hill 2014 CTC Retreat - Ctc presentation fran dykstra oct 2014 v5
 
UNC Chapel Hill 2014 CTC Retreat - unc transition to voice over ip
UNC Chapel Hill 2014 CTC Retreat -   unc transition to voice over ipUNC Chapel Hill 2014 CTC Retreat -   unc transition to voice over ip
UNC Chapel Hill 2014 CTC Retreat - unc transition to voice over ip
 
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business Intelligence
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business IntelligenceUNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business Intelligence
UNC Chapel Hill Ctc Retreat 2014 SAS Visual Analytics and Business Intelligence
 
UNC Chapel Hill 2014 CTC Retreat - Creating epub e books
UNC Chapel Hill 2014 CTC Retreat - Creating epub e booksUNC Chapel Hill 2014 CTC Retreat - Creating epub e books
UNC Chapel Hill 2014 CTC Retreat - Creating epub e books
 
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset Managment
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset ManagmentUNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset Managment
UNC Chapel Hill 2014 CTC Retreat - Media Streaming/Digital Asset Managment
 
CIO/CTO Ctc presentation fall 2014
CIO/CTO Ctc presentation fall 2014CIO/CTO Ctc presentation fall 2014
CIO/CTO Ctc presentation fall 2014
 

Similar to UNC Chapel Hill 2014 CTC Retreat - SAS Proc codebook sheps

UNIT 3.2 GETTING STARTED WITH IDA.ppt
UNIT 3.2 GETTING STARTED WITH IDA.pptUNIT 3.2 GETTING STARTED WITH IDA.ppt
UNIT 3.2 GETTING STARTED WITH IDA.pptManjuAppukuttan2
 
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docx
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docxINFO-6053 Fall 2017 Project 3 Page 1 of 6 .docx
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docxjaggernaoma
 
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdf
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdfRStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdf
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdfAkshay Sahatpure
 
Seminar Topic Registry (M.Tech)
Seminar Topic Registry (M.Tech) Seminar Topic Registry (M.Tech)
Seminar Topic Registry (M.Tech) Yashpal Rathore
 
Mainframe Technology Overview
Mainframe Technology OverviewMainframe Technology Overview
Mainframe Technology OverviewHaim Ben Zagmi
 
Mca pro1 online
Mca pro1 onlineMca pro1 online
Mca pro1 onlinerameshvvv
 
Program logic and design
Program logic and designProgram logic and design
Program logic and designChaffey College
 
CIS 336 (DEVRY) Entire Course NEW
CIS 336 (DEVRY) Entire Course NEWCIS 336 (DEVRY) Entire Course NEW
CIS 336 (DEVRY) Entire Course NEWshyamuopuop
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdfDinashMaliya3
 
Sas UTR How To Create Your UTRs Sep2009
Sas UTR How To Create Your UTRs Sep2009Sas UTR How To Create Your UTRs Sep2009
Sas UTR How To Create Your UTRs Sep2009praack
 

Similar to UNC Chapel Hill 2014 CTC Retreat - SAS Proc codebook sheps (20)

Readme
ReadmeReadme
Readme
 
INTRODUCTION TO SAS
INTRODUCTION TO SASINTRODUCTION TO SAS
INTRODUCTION TO SAS
 
SAS Programming Notes
SAS Programming NotesSAS Programming Notes
SAS Programming Notes
 
File handling
File handlingFile handling
File handling
 
UNIT 3.2 GETTING STARTED WITH IDA.ppt
UNIT 3.2 GETTING STARTED WITH IDA.pptUNIT 3.2 GETTING STARTED WITH IDA.ppt
UNIT 3.2 GETTING STARTED WITH IDA.ppt
 
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docx
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docxINFO-6053 Fall 2017 Project 3 Page 1 of 6 .docx
INFO-6053 Fall 2017 Project 3 Page 1 of 6 .docx
 
Introduction to STATA - Ali Rashed
Introduction to STATA - Ali RashedIntroduction to STATA - Ali Rashed
Introduction to STATA - Ali Rashed
 
Sas classes in mumbai
Sas classes in mumbaiSas classes in mumbai
Sas classes in mumbai
 
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdf
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdfRStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdf
RStudio_s_R_Markdown_documentation_Cheat_Cheet__1677232908.pdf
 
Apps1
Apps1Apps1
Apps1
 
Seminar Topic Registry (M.Tech)
Seminar Topic Registry (M.Tech) Seminar Topic Registry (M.Tech)
Seminar Topic Registry (M.Tech)
 
pm1
pm1pm1
pm1
 
Mainframe Technology Overview
Mainframe Technology OverviewMainframe Technology Overview
Mainframe Technology Overview
 
Mca pro1 online
Mca pro1 onlineMca pro1 online
Mca pro1 online
 
Pl sql using_xml
Pl sql using_xmlPl sql using_xml
Pl sql using_xml
 
Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0
 
Program logic and design
Program logic and designProgram logic and design
Program logic and design
 
CIS 336 (DEVRY) Entire Course NEW
CIS 336 (DEVRY) Entire Course NEWCIS 336 (DEVRY) Entire Course NEW
CIS 336 (DEVRY) Entire Course NEW
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdf
 
Sas UTR How To Create Your UTRs Sep2009
Sas UTR How To Create Your UTRs Sep2009Sas UTR How To Create Your UTRs Sep2009
Sas UTR How To Create Your UTRs Sep2009
 

Recently uploaded

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Recently uploaded (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

UNC Chapel Hill 2014 CTC Retreat - SAS Proc codebook sheps

  • 1. PROC_CODEBOOK: An Automated, General Purpose Codebook Generator Kim Chantala, email: kim_chantala@unc.edu Sheps Center for Health Services Research Jim Terry email: jim_terry@unc.edu Carolina Population Center University of North Carolina at Chapel Hill
  • 2. 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.
  • 3. Sample Code %include 'C:My_projectHWT_short_formats.sas'; %include ' C:My_projectproc_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;
  • 4. PDF file created by PROC_CODEBOOK
  • 5. 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.
  • 6. 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;
  • 7. 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);
  • 8. PROC_CODEBOOK syntax %proc_codebook(lib=libname, file1=SAS_dataset, fmtlib=work.formats, pdffile=codebook_file.pdf, include_warn=NO);
  • 9. The macro variables  Required 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.
  • 10. Warning Messages  Categories of formats not used by a variable  Variables that have missing data for all observations  Variables that are constant
  • 11. 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:datalysLogodatalys_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:datalysChantalaData Dec2009injwvb0409.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_projectinjwvb0409_codebook.pdf, include_warn=NO);
  • 12. PDF file created by PROC_CODEBOOK:
  • 13. SAS CODE The SAS codebook macro & documentation can be downloaded from the following location: http://www.cpc.unc.edu/research/tools/data_analysis/proc_codebook