Lecture7 - Chapter 11: Enhancing Reports 11.1 Using Global...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Chapter 11: Enhancing Reports 11.1 Using Global Statements 11.2 Adding Labels and Formats 11.3 Creating User-Defined Formats 11.4 Subsetting and Grouping Observations 11.5 Directing Output to External Files
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Objectives Create user-defined formats using the FORMAT procedure. Apply user-defined formats to variables in reports.
Background image of page 2
3 User-Defined Formats A user-defined format needs to be created for Country . Current Report (partial output) Desired Report (partial output) Annual Date of Date of Obs Sales ID Job Title Salary Country Birth Hire 61 120179 Sales Rep. III $28,510 Australia MAR1974 JAN2004 62 120180 Sales Rep. II $26,970 Australia JUN1954 DEC1978 63 120198 Sales Rep. III $28,025 Australia JAN1988 DEC2006 64 120261 Chief Sales Officer $243,190 United States FEB1969 AUG1987 65 121018 Sales Rep. II $27,560 United States JAN1944 JAN1974 66 121019 Sales Rep. IV $31,320 United States JUN1986 JUN2004 Annual Date of Date of Obs Sales ID Job Title Salary Country Birth Hire 61 120179 Sales Rep. III $28,510 AU MAR1974 JAN2004 62 120180 Sales Rep. II $26,970 AU JUN1954 DEC1978 63 120198 Sales Rep. III $28,025 AU JAN1988 DEC2006 64 120261 Chief Sales Officer $243,190 US FEB1969 AUG1987 65 121018 Sales Rep. II $27,560 US JAN1944 JAN1974 66 121019 Sales Rep. IV $31,320 US JUN1986 JUN2004
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 User-Defined Formats To create and use your own formats, do the following: Part 1 Use the FORMAT procedure to create the user-defined format. Apply the format to a specific variable(s) by using a FORMAT statement in the reporting procedure. Part 2
Background image of page 4
5 The FORMAT Procedure The FORMAT procedure is used to create user-defined formats. General form of the FORMAT procedure with the VALUE statement: PROC FORMAT; VALUE format-name range1 = ' label ' range2 = ' label ' . . . ; RUN;
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 The FORMAT Procedure A format-name names the format that you are creating cannot be more than 32 characters in SAS ® 9 for character values, must have a dollar sign ($) as the first character, and a letter or underscore as the second character for numeric values, must have a letter or underscore as the first character cannot end in a number cannot be the name of a SAS format does not end with a period in the VALUE statement.
Background image of page 6
7 Quiz Which user-defined format names are invalid? a. $stfmt b. $3levels c. _4years d. salranges e. dollar
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Quiz Correct Answer Which user-defined format names are invalid? a. $stfmt b. $3levels c. _4years d. salranges e. dollar Character formats must have a dollar sign as the first character and a letter or underscore as the second character. User-defined formats cannot be the name of a SAS supplied format.
Background image of page 8
9 The FORMAT Procedure Range(s) can be single values ranges of values lists of values. Labels can be up to 32,767 characters in length are typically enclosed in quotation marks, although it is not required.
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 Character User-Defined Format The OTHER keyword matches all values that do not match any other value or range. proc format; value $ctryfmt 'AU' = 'Australia' 'US' = 'United States' other = 'Miscoded'; run; character format name keyword labels p111d07 discrete character values
Background image of page 10
11 proc format; 'AU' = 'Australia' 'US' = 'United States' other = 'Miscoded'; run; proc print data=orion.sales label; var Employee_ID Job_Title Salary Country Birth_Date Hire_Date;
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 186

Lecture7 - Chapter 11: Enhancing Reports 11.1 Using Global...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online