SAS Certification Prep Guide Chapter 7 Creating and Applying User-Defined Formats.

Slides:



Advertisements
Similar presentations
VARIABLES AND DEBUGGING Beginning Programming. Assignment Statements  Used to hold values in a variable  Calculates a result and stores it in a variable.
Advertisements

SAS Programming:File Merging and Manipulation. Reading External Files (review) data barf; * create the dataset BARF; infile ’s:\mysas\Table7.1'; * open.
Chapter 9: Introducing Macro Variables 1 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Introduction to SAS Programming Christina L. Ughrin Statistical Software Consulting Some notes pulled from SAS Programming I: Essentials Training.
The Web Warrior Guide to Web Design Technologies
Chapter 2 Review Questions
Permanent Formats and Working Across Platforms. 32bit vs. 64 bit SAS The different versions of SAS optimize datasets and formats to work as fast as possible.
Introduction to C Topics Compilation Using the gcc Compiler
PROC_CODEBOOK: An Automated, General Purpose Codebook Generator
By: Mr. Baha Hanene Chapter 4. LEARNING OUTCOMES This chapter will cover learning outcome no. 2 i.e. Use basic data-types and input / output in C programs.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
Creating SAS® Data Sets
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
FORMAT FESTIVAL AN INTRODUCTION TO SAS® FORMATS AND INFORMATS By David Maddox.
“SAS macros are just text substitution!” “ARRRRGGHHH!!!”
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Chapter 10:Processing Macro Variables at Execution Time 1 STAT 541 © Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
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.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
Chapter 9 Character Strings 9.1 Character String Constants A character string constant is a sequence of characters enclosed in double quotation mark. Examples.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
Introduction to SAS. What is SAS? SAS originally stood for “Statistical Analysis System”. SAS is a computer software system that provides all the tools.
©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina Chapter 17 supplement: Review of Formatting Data STAT 541.
BMTRY 789 Lecture 2 SAS Syntax, entering raw data, etc. Lecturer: Annie N. Simpson, MSc. Readings – Chapters 1, 2, 12, & 13 Lab Problems 1.1, 1.2, 1.3,
5/30/2010 SAS Macro Language Group 6 Pradnya Nimkar, Li Lin, Linsong Zhang & Loc Tran.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
June 12, 2009 Toronto Area SAS Society 1 What’s new in BASE SAS 9.2 Checkpoint/Restart Rupinder Dhillon Dhillon Consulting Inc.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
Summer SAS Workshop Lecture 2. Summer Summer SAS Workshop Lecture 2 I’ve got Data…how do I get started? Libname Review How do you do arithmetic.
1 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Accessing Remote Data 2.4 Importing Text Files.
7 1 User-Defined Functions CGI/Perl Programming By Diane Zak.
Chapter 16: Using Lookup Tables to Match Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
A Simple Guide to Using SPSS ( Statistical Package for the Social Sciences) for Windows.
1 EPIB 698E Lecture 1 Notes Instructor: Raul Cruz 7/9/13.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
How to start using SAS Tina Tian. The topics An overview of the SAS system Reading raw data/ create SAS data set Combining SAS data sets & Match merging.
Chapter 5 Reading and Manipulating SAS ® Data Sets and Creating Detailed Reports Xiaogang Su Department of Statistics University of Central Florida.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
Effective SAS greplay’ing and how to avoid stretching By David Mottershead Senior Programmer, Quanticate.
1 Chapter 6: Using Prompts in Tasks and Queries 6.1 Prompting in Projects 6.2 Creating and Using Prompts in Tasks 6.3 Creating and Using Prompts in Queries.
Chapter 4 concerns various SAS procedures (PROCs). Every PROC operates on: –the most recently created dataset –all the observations –all the appropriate.
Chapter 17: Formatting Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
Chapter 3 Control Structures. The If…Then Statement The If…Then statement is a Decision statement = that executes a set of statements when a condition.
Chapter 14 Formatting Readable Output. Chapter Objectives  Add a column heading with a line break to a report  Format the appearance of numeric data.
Chapter 1: Overview of SAS System Basic Concepts of SAS System.
Strings See Chapter 2 u Review constants u Strings, concatenation and repetition 1.
Copyright © 2010, SAS Institute Inc. All rights reserved. SAS ® Using the SAS Grid.
SAS for Data Management and Analysis
Creating a Java Application and Applet
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.
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.
1 Introduction to SAS Available at
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Chapter 4: Variables, Constants, and Arithmetic Operators Introduction to Programming with C++ Fourth Edition.
Chapter 3 Table Creation and Management Oracle 10g: SQL.
Writing Basic SQL SELECT Statements Lecture
1 Checking Data with the PRINT and FREQ Procedures.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapter 25 By Tasha Chapman, Oregon Health Authority.
Copyright 2009 The Little Engine That Could: Using EXCEL LIBNAME Engine Options to Enhance Data Transfers between SAS® and Microsoft® Excel Files William.
CCSA 221 Programming in C CHAPTER 3 COMPILING AND RUNNING YOUR FIRST PROGRAM 1 ALHANOUF ALAMR.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
Temporary vs. Permanent SAS Data Sets
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Writing Basic SQL SELECT Statements
Lesson 3 Chapter 10.
Instructor: Raul Cruz 9/4/13
Presentation transcript:

SAS Certification Prep Guide Chapter 7 Creating and Applying User-Defined Formats

Objectives In this chapter, you learn to create your own formats for displaying variable values permanently store the formats that you create associate your formats with variable.

Invoking PROC FORMAT General form, PROC FORMAT statement: PROC FORMAT ; where options includes: LIBRARY=libref specifies the libref for a SAS data library that contains a permanent catalog in which user-defined formats are stored FMTLIB prints the contents of a format catalog.

Permanently Storing Your Formats First, you need a LIBNAME statement that associates the libref with the permanent SAS data library where the format catalog is to be stored. libname library ‘c:\sas\formats\lib’; Now, any format that you create in this PROC FORMAT step is stored in a permanent format catalog called Library.Formats. libname library ‘c:\sas\formats\lib’; proc format library=library; …; run;

Defining a Unique Format General form, VALUE statement: VALUE format-name range1=‘label1’ range2=‘label2’ … ; where format-name names the format being created. The format name * must begin with a $ if the format applies to character data * can’t be longer than eight characters * can’t be the name of an existing SAS format * can’t end with a number * doesn’t end with a period when specified in a VALUE statement.

Defining a Unique Format (cont.) range specifies one or more variable values and a character string or an existing format label is a text string enclosed in quotation marks.

Defining Multiple Formats proc format lib=library; value $grade ‘A’=‘Good’ ‘B’-’D’=‘Fair’ ‘F’=‘Poor’; value agefmt low-<13=‘child’ 13-<20=‘teenager’ 20-<65=‘adult’ 65-high=‘senior’; run;

Assigning Your Formats to Variables Just as with SAS formats, you associate a user-defined format with a variable in a FORMAT statement. data school; set school; format grade $grade. age agefmt.; run; You can place the FORMAT statement in a DATA or PROC step. By placing it in the DATA step, you can permanently associate a format with a variable. You do not have to specify a width value when using a user-defined format.

Assigning Your Formats to Variables (cont.) When associating a format with a variable, remember to use the same format name in the FORMAT statement that was specified in the VALUE statement place a period at the end of the format name when it’s used in the FORMAT statement.

Displaying a List of Your Formats Adding the keyword FMTLIB to the PROC FORMAT statement displays a list of all the formats in your catalog, along with the descriptions of their values. libname library ‘c:\sas\formats\lib’; proc format lib=library fmtlib; run; In addition to the name, range, and label, the format description includes the: length of the longest label number of values defined by this format version of SAS that this format is compatible with date and time of creation.