SlideShare a Scribd company logo
The REPORT Procedure
Seema Shelke
Learning Objectives
• Create a listing report
• Select columns for your report
• Define the usage for columns
• Specify attributes, options, and justification for
columns
• Specify features of column headings, including split
characters, underlining, and blank lines.
Features
 PROC REPORT enables you to
• create listing reports
• create summary reports
• enhance reports
• request separate subtotals and grand totals
• calculate columns
• generate reports in an interactive point-and-click or
programming environments.
Creating a Default List Report
General form of a simple PROC REPORT step:
PROC REPORT <DATA=SAS-data-set> <options>;
RUN;
Options includes:
WINDOWS | WD invokes the procedure in an
interactive REPORT window
(default).
NOWINDOWS | NOWD displays the report in the
OUTPUT window.
Sample Data used for reporting
• The mylib.fitness dataset contains the medical
records for a sample of patients.
• This dataset contains variables such as PatID,
First_Name, Last_Name,Gender, Age, Height,
Weight,Smoking,and Race.
Creating a Default List Report
proc report data=mylib.fitness ;
run;
proc report data=mylib.fitness nowd;
run;
SAS Listing Output
Creating a Default List Report
SAS HTML Output:
The REPORT Procedure
 The PROC Report displays
• each data value the way it is stored in the data set, or
formatted value if a format is stored with the data
• variable names or labels as report column headings
• a default width for the report columns
• character values left-justified
• numeric values right-justified
• observations in the order in which they are stored in the
data set.
Selecting Variables
Use a COLUMN statement to select and order the
variables that appear in the report.
General form of the COLUMN statement:
COLUMN variable(s);
where variable(s) is one or more variable names, separated
by blanks.
Selecting Variables
proc report data=mylib.fitness nowd ;
column patid gender age height_cm weight_kg;
run;
SAS Output
Selecting Observations
 Use WHERE statement to select the observations for
your report.
proc report data=mylib.fitness nowd;
column patid gender race age height_cm weight_kg;
where race in ('Black' ,'Asian');
run;
SAS Output
Displays only the records where race is Black or Asian
The DEFINE Statement
 You can enhance the report by using DEFINE
statements to
• define how each variable is used in the report
• assign formats to variables
• specify column headings and column widths
• justify the variable values and column headings within
the report columns
• change the order of the rows in the report.
The DEFINE Statement
General form of the DEFINE statement:
DEFINE variable / <usage> <attribute(s)> <option(s)>
<justification> <'column-heading'> ;
Where,
• variable is the name of the variable to define.
• usage specifies how to use the variable. Valid options are ACROSS,
ANALYSIS, COMPUTED, DISPLAY, GROUP, and ORDER.
• attribute(s) specifies attributes for the variable, including FORMAT=,
WIDTH=, and SPACING=.
• option(s) specifies formatting options, including DESCENDING,
NOPRINT, NOZERO, and PAGE.
• <justification> specifies column justification (CENTER, LEFT, or
RIGHT).
• 'column-heading' specifies a label for the column heading.
Defining Column Attributes
If there is a format stored in the descriptor portion of the
data set, it is the default format.
The default column width is,
• the variable’s length for character variables
• 9 for numeric variables
• the format width if there is a format stored in the descriptor
portion of the data set.
WIDTH= column-width : specifies the width of a column.
FORMAT= format : assigns a format to a variable.
Defining Column Attributes
If there is a label stored in the descriptor portion of the
data set, it is the default header.
‘report-column-header’ : defines the column header.
SPACING= horizontal positions : Specifies how many
blank characters to leave between the selected
column and the column immediately to its left. The
default is 2.
Defining Column Attributes
1. Add format to display height and weight with decimals.
2. Increase the column widths
3. Increase the spacing
4. Change column headings
proc report data=mylib.fitness nowd;
column patid gender age height_cm weight_kg;
define patid/'Patient ID';
define height_cm / format =6.2 width=11 spacing=5
'Height (cm)';
define weight_kg / format=5.2 width=11 spacing=5
'Weight (kg)';
run;
Defining Column Attributes
SAS Listing Output SAS HTML Output
Note: Width and spacing attributes in the Define statement
has no effect on HTML output.
Splitting Column Headings across
Multiple Lines
To split character,
• Use the default slash (/) as the split character.
• Define a split character by using the SPLIT= option in the
PROC REPORT statement.
proc report data=mylib.fitness nowd;
column patid gender age height_cm weight_kg;
define patid/'Patient ID';
define height_cm / format =6.2 width=6 spacing=5
'Height/(cm)';
define weight_kg / format=5.2 width=6 spacing=5
'Weight/(kg)';
run;
Splitting Column Headings across
Multiple Lines
SAS Output:
Specifying Column Justification
To specify justification, add option CENTER, LEFT, or
RIGHT in the DEFINE statement.
proc report data=mylib.fitness nowd split='*';
column patid gender age height_cm weight_kg;
define patid/'Patient ID' left;
define age/ center;
define height_cm / format =6.2 width=6 spacing=5
'Height*(cm)' center;
define weight_kg / format=5.2 width=6 spacing=5
'Weight*(kg)' center;
run;
Specifying Column Justification
SAS Output:
Enhancing the Heading’s Appearance
• HEADLINE : underlines all column headings and the
spaces between them.
• HEADSKIP : writes a blank line beneath all column
headings or after the underline if the HEADLINE option is
used.
These options have no effect on HTML output.
proc report data=mylib.fitness nowd headline headskip;
column patid gender age height_cm weight_kg;
define patid/'Patient ID';
define height_cm / format =6.2 width=6 spacing=5
'Height/(cm)';
define weight_kg / format=5.2 width=6 spacing=5
'Weight/(kg)';
run;
Enhancing the Heading’s Appearance
SAS Output:
Variable Usage
PROC REPORT uses each variable in one of six ways,
• DISPLAY
• ORDER
• GROUP
• ACROSS
• ANALYSIS
• COMPUTED
By default, PROC REPORT uses,
• character variables as display variables
• numeric variables as analysis variables, which are used to
calculate the SUM (default) statistic.
Defining Order Variables
ORDER : orders the rows in the report.
• Orders the report in ascending (default) order. Include the
DESCENDING option in the DEFINE statement to force the order
to be descending.
• Suppresses repetitious printing of values.
• Does not need data to be previously sorted.
proc report data=mylib.fitness nowd ;
column gender patid age height_cm weight_kg smoking race;
define gender/order width=6;
define patid/ 'Patient ID' width=10 left;
define age/ width=3 center;
define height_cm / format =6.2 width=11 spacing=5 'Height/(cm)' center;
define weight_kg / format=5.2 width=11 spacing=5 'Weight/(kg)' center;
run;
Defining Order variables
SAS Output:
Displays the data in order by Gender.
Defining Group Variables
 Use the REPORT procedure to create a summary report by
defining variables as group variables.
 To define a group variable, specify the GROUP usage option
in the DEFINE statement.
 All observations whose group variables have the same values
are collapsed into a single row in the report.
 You can define more than one variable as a group variable.
 Nesting of group variables is determined by the order
of the variables in the COLUMN statement.
 If you have a group variable, there must be no display or
order variables.
 Group variables produce summary reports (observations
collapsed into groups).
 Display and order variables produce listing reports(one row
for each observation).
Defining Group Variables
proc report data=mylib.fitness nowd ;
column gender smoking weight_kg ;
define gender/group width=6;
define smoking/group width=7;
define weight_kg / format=5.2 width=11 'Weight/(kg)' center;
run;
SAS Output
Displays the total weight gender wise and smoking habit wise
Note: The default statistic for the analysis variables is SUM.
Defining Analysis Variables
• The default statistic for analysis variables is SUM.
• To specify a statistic other than SUM (default), specify
the statistic as an attribute in the DEFINE statement
• Below are the few statistics that can be used in Proc
Report;
N Number of nonmissing values
MEAN Average value
MIN Minimum value
MAX Maximum value
STD Standard Deviation
Defining Analysis Variables
proc report data=mylib.fitness nowd ;
column gender smoking height_cm weight_kg;
define gender/group width=6;
define smoking/group width=7;
define height_cm / mean format =6.2 width=19 spacing=5
'Average Height/(cm)' center;
define weight_kg / mean format=5.2 width=19 spacing=5
'Average Weight/(kg)' center;
run;
SAS Output
Defining Across Variables
• Variables can also be defined as Across variables
which are functionally similar to group variables.
However, PROC REPORT displays the groups that it
creates for an across variable horizontally rather than
vertically.
proc report data=mylib.fitness nowd ;
column gender smoking height_cm weight_kg;
define gender/across width=6;
define smoking/across width=7;
define height_cm / mean format =6.2 width=19 spacing=5
'Average Height/(cm)' center;
define weight_kg / mean format=5.2 width=19 spacing=5
'Average Weight/(kg)' center;
run;
Defining Across Variables
SAS Output:
Notes:
• For each across variable, the table cells contain a frequency
count for each unique value.
• For each analysis variable, the table cells represent the sum of
all the variable's values.
Defining Computed Variables
 Computed variables are the new variables that you define for
the report. They are not present in the input dataset.
 Computed variables can be either numeric or character
variables.
 You cannot change the usage of a computed variable.
 To add a computed variable in Proc Report,
• Include the computed variable in the COLUMN statement.
• Define the variable's usage as COMPUTED in the DEFINE
statement.
• Compute the value of the variable in a compute block that is
associated with the variable.
 The position of a computed variable is very important. You
can't base the calculation of a computed variable on any
variable that appears to its right in the report. So in COLUMN
statement specify the computed variable to the right of the
variables that are used in its calculation.
Defining Computed Variables
proc report data=mylib.fitness nowd ;
column first_name last_name gender race age
smoking weight_kg height_cm bmi;
define first_name/'First Name' width=10;
define last_name/'Last Name' width=9;
define smoking/width=7;
define height_cm / format =6.2 width=6 'Height (cm)';
define weight_kg / format=5.2 width=6 'Weight (kg)';
define bmi / computed 'Body Mass Index' format=5.2
width=15;
compute bmi;
bmi= weight_kg.sum/(height_cm.sum*0.01)**2;
endcomp;
run;
Computed
variable
Defining Computed Variables
SAS Output:
Computes the variable Body Mass Index using weight and
height data.
Thank You !

More Related Content

What's hot

Base SAS Statistics Procedures
Base SAS Statistics ProceduresBase SAS Statistics Procedures
Base SAS Statistics Procedures
guest2160992
 
Sas cheat
Sas cheatSas cheat
Sas cheat
imaduddin91
 
Arrays in SAS
Arrays in SASArrays in SAS
Arrays in SAS
guest2160992
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SAS
guest2160992
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
Ali Ajouz
 
SAS Macros part 1
SAS Macros part 1SAS Macros part 1
SAS Macros part 1
venkatam
 
Sas Plots Graphs
Sas Plots GraphsSas Plots Graphs
Sas Plots Graphs
guest2160992
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questions
Dr P Deepak
 
ADaM - Where Do I Start?
ADaM - Where Do I Start?ADaM - Where Do I Start?
ADaM - Where Do I Start?
Dr.Sangram Parbhane
 
Basics of SAS
Basics of SASBasics of SAS
Basics of SAS
Taddesse Kassahun
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
Ravi Mandal, MBA
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
izahn
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
guest2160992
 
Sas macros part 4.1
Sas macros part 4.1Sas macros part 4.1
Sas macros part 4.1
venkatam
 
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 SolutionLearning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
Vibeesh CS
 
Introduction to sas
Introduction to sasIntroduction to sas
Introduction to sas
Ajay Ohri
 
Sas
SasSas
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
Ayapparaj SKS
 
Where conditions and Operators in SQL
Where conditions and Operators in SQLWhere conditions and Operators in SQL
Where conditions and Operators in SQL
MSB Academy
 
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
Ayapparaj SKS
 

What's hot (20)

Base SAS Statistics Procedures
Base SAS Statistics ProceduresBase SAS Statistics Procedures
Base SAS Statistics Procedures
 
Sas cheat
Sas cheatSas cheat
Sas cheat
 
Arrays in SAS
Arrays in SASArrays in SAS
Arrays in SAS
 
Utility Procedures in SAS
Utility Procedures in SASUtility Procedures in SAS
Utility Procedures in SAS
 
SAS cheat sheet
SAS cheat sheetSAS cheat sheet
SAS cheat sheet
 
SAS Macros part 1
SAS Macros part 1SAS Macros part 1
SAS Macros part 1
 
Sas Plots Graphs
Sas Plots GraphsSas Plots Graphs
Sas Plots Graphs
 
Base sas interview questions
Base sas interview questionsBase sas interview questions
Base sas interview questions
 
ADaM - Where Do I Start?
ADaM - Where Do I Start?ADaM - Where Do I Start?
ADaM - Where Do I Start?
 
Basics of SAS
Basics of SASBasics of SAS
Basics of SAS
 
Understanding sas data step processing.
Understanding sas data step processing.Understanding sas data step processing.
Understanding sas data step processing.
 
Introduction to SAS
Introduction to SASIntroduction to SAS
Introduction to SAS
 
Understanding SAS Data Step Processing
Understanding SAS Data Step ProcessingUnderstanding SAS Data Step Processing
Understanding SAS Data Step Processing
 
Sas macros part 4.1
Sas macros part 4.1Sas macros part 4.1
Sas macros part 4.1
 
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 SolutionLearning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
Learning SAS With Example by Ron Cody :Chapter 16 to Chapter 20 Solution
 
Introduction to sas
Introduction to sasIntroduction to sas
Introduction to sas
 
Sas
SasSas
Sas
 
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
SAS Ron Cody Solutions for even Number problems from Chapter 7 to 15
 
Where conditions and Operators in SQL
Where conditions and Operators in SQLWhere conditions and Operators in SQL
Where conditions and Operators in SQL
 
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
SAS Ron Cody Solutions for even Number problems from Chapter 16 to 20
 

Viewers also liked

Introduction to Statistics (Part -I)
Introduction to Statistics (Part -I)Introduction to Statistics (Part -I)
Introduction to Statistics (Part -I)
YesAnalytics
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
Venkata Reddy Konasani
 
Building Anomaly Detections Systems
Building Anomaly Detections SystemsBuilding Anomaly Detections Systems
Building Anomaly Detections Systems
Humberto Marchezi
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
halasti
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
Srinimf-Slides
 
INTRODUCTION TO SAS
INTRODUCTION TO SASINTRODUCTION TO SAS
INTRODUCTION TO SAS
Bhuwanesh Rawat
 
Improving Effeciency with Options in SAS
Improving Effeciency with Options in SASImproving Effeciency with Options in SAS
Improving Effeciency with Options in SAS
guest2160992
 
Introduction to excel - application to statistics
Introduction to excel - application to statisticsIntroduction to excel - application to statistics
Introduction to excel - application to statistics
zavenger
 
Applications of statistics
Applications of statisticsApplications of statistics
Applications of statistics
Vinit Suchak
 
SAS BASICS
SAS BASICSSAS BASICS
SAS BASICS
Bhuwanesh Rawat
 
SAS Presentation
SAS PresentationSAS Presentation
SAS Presentation
Kali Howard
 
Use of Statistics in real life
Use of Statistics in real lifeUse of Statistics in real life
Use of Statistics in real life
Engr Habib ur Rehman
 
Practical use of mean mode median
Practical use of mean mode median Practical use of mean mode median
Practical use of mean mode median
Federation of Industries
 
Role of statistics in real life , business & good governance
Role of statistics in real life , business & good governanceRole of statistics in real life , business & good governance
Role of statistics in real life , business & good governance
Department of Mathematics and Statistics, Ramjas College, Delhi University
 
Use of statistics in real life
Use of statistics in real lifeUse of statistics in real life
Use of statistics in real life
Harsh Rajput
 
Applications of statistics in daily life
Applications of statistics in daily lifeApplications of statistics in daily life
Applications of statistics in daily life
minah habib
 
Comparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statementsComparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statements
Lucas Jellema
 
Mean, median, mode, & range ppt
Mean, median, mode, & range pptMean, median, mode, & range ppt
Mean, median, mode, & range ppt
mashal2013
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
madan kumar
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
akbhanj
 

Viewers also liked (20)

Introduction to Statistics (Part -I)
Introduction to Statistics (Part -I)Introduction to Statistics (Part -I)
Introduction to Statistics (Part -I)
 
SAS basics Step by step learning
SAS basics Step by step learningSAS basics Step by step learning
SAS basics Step by step learning
 
Building Anomaly Detections Systems
Building Anomaly Detections SystemsBuilding Anomaly Detections Systems
Building Anomaly Detections Systems
 
Introduction To Sas
Introduction To SasIntroduction To Sas
Introduction To Sas
 
SAS Mainframe -Program-Tips
SAS Mainframe -Program-TipsSAS Mainframe -Program-Tips
SAS Mainframe -Program-Tips
 
INTRODUCTION TO SAS
INTRODUCTION TO SASINTRODUCTION TO SAS
INTRODUCTION TO SAS
 
Improving Effeciency with Options in SAS
Improving Effeciency with Options in SASImproving Effeciency with Options in SAS
Improving Effeciency with Options in SAS
 
Introduction to excel - application to statistics
Introduction to excel - application to statisticsIntroduction to excel - application to statistics
Introduction to excel - application to statistics
 
Applications of statistics
Applications of statisticsApplications of statistics
Applications of statistics
 
SAS BASICS
SAS BASICSSAS BASICS
SAS BASICS
 
SAS Presentation
SAS PresentationSAS Presentation
SAS Presentation
 
Use of Statistics in real life
Use of Statistics in real lifeUse of Statistics in real life
Use of Statistics in real life
 
Practical use of mean mode median
Practical use of mean mode median Practical use of mean mode median
Practical use of mean mode median
 
Role of statistics in real life , business & good governance
Role of statistics in real life , business & good governanceRole of statistics in real life , business & good governance
Role of statistics in real life , business & good governance
 
Use of statistics in real life
Use of statistics in real lifeUse of statistics in real life
Use of statistics in real life
 
Applications of statistics in daily life
Applications of statistics in daily lifeApplications of statistics in daily life
Applications of statistics in daily life
 
Comparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statementsComparing 30 MongoDB operations with Oracle SQL statements
Comparing 30 MongoDB operations with Oracle SQL statements
 
Mean, median, mode, & range ppt
Mean, median, mode, & range pptMean, median, mode, & range ppt
Mean, median, mode, & range ppt
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
 
Introduction to statistics
Introduction to statisticsIntroduction to statistics
Introduction to statistics
 

Similar to A Step-By-Step Introduction to SAS Report Procedure

Enhancing statistical report capabilities using the clin plus report engine
Enhancing statistical report capabilities using the clin plus report engineEnhancing statistical report capabilities using the clin plus report engine
Enhancing statistical report capabilities using the clin plus report engine
Clin Plus
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SAS
Jorge Rodríguez M.
 
Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
todd331
 
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Transform Financial Reporting Using Master Row Sets in Oracle E-Business SuiteTransform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
eprentise
 
Producing Descriptive Statistics(proc means) .pptx
Producing Descriptive Statistics(proc means) .pptxProducing Descriptive Statistics(proc means) .pptx
Producing Descriptive Statistics(proc means) .pptx
SAYAN DAS
 
Spss
SpssSpss
Spss
Tech_MX
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
Carlos Oliveira
 
11i&r12 difference
11i&r12 difference11i&r12 difference
11i&r12 difference
venki_venki
 
4. chapter iv(transform)
4. chapter iv(transform)4. chapter iv(transform)
4. chapter iv(transform)
Chhom Karath
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 Lecture
Wake Tech BAS
 
Ps training mannual ( configuration )
Ps training mannual ( configuration )Ps training mannual ( configuration )
Ps training mannual ( configuration )
Soumya De
 
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical ExpressionsUnit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
dubon07
 
oracle-reports6i
oracle-reports6ioracle-reports6i
oracle-reports6i
CHANDRASEKHAR REDROUTHU
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Error-Bar_Charts.pdf
Error-Bar_Charts.pdfError-Bar_Charts.pdf
Error-Bar_Charts.pdf
amba4
 
Pl sql best practices document
Pl sql best practices documentPl sql best practices document
Pl sql best practices document
Ashwani Pandey
 
R04 - Basics of Reporting: Report Setup Part 2
R04 - Basics of Reporting: Report Setup Part 2 R04 - Basics of Reporting: Report Setup Part 2
R04 - Basics of Reporting: Report Setup Part 2
Maintenance Connection
 
Pandas csv
Pandas csvPandas csv
Pandas csv
Devashish Kumar
 
Programming-in-C
Programming-in-CProgramming-in-C
Programming-in-C
DrPrabakaranPerumal
 
SPSS an intro...
SPSS an intro...SPSS an intro...
SPSS an intro...
Jithin Zcs
 

Similar to A Step-By-Step Introduction to SAS Report Procedure (20)

Enhancing statistical report capabilities using the clin plus report engine
Enhancing statistical report capabilities using the clin plus report engineEnhancing statistical report capabilities using the clin plus report engine
Enhancing statistical report capabilities using the clin plus report engine
 
Introducción al Software Analítico SAS
Introducción al Software Analítico SASIntroducción al Software Analítico SAS
Introducción al Software Analítico SAS
 
Sample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docxSample Questions The following sample questions are not in.docx
Sample Questions The following sample questions are not in.docx
 
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Transform Financial Reporting Using Master Row Sets in Oracle E-Business SuiteTransform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
Transform Financial Reporting Using Master Row Sets in Oracle E-Business Suite
 
Producing Descriptive Statistics(proc means) .pptx
Producing Descriptive Statistics(proc means) .pptxProducing Descriptive Statistics(proc means) .pptx
Producing Descriptive Statistics(proc means) .pptx
 
Spss
SpssSpss
Spss
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
11i&r12 difference
11i&r12 difference11i&r12 difference
11i&r12 difference
 
4. chapter iv(transform)
4. chapter iv(transform)4. chapter iv(transform)
4. chapter iv(transform)
 
BAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 LectureBAS 150 Lesson 4 Lecture
BAS 150 Lesson 4 Lecture
 
Ps training mannual ( configuration )
Ps training mannual ( configuration )Ps training mannual ( configuration )
Ps training mannual ( configuration )
 
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical ExpressionsUnit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
Unit 4 - Basic ABAP statements, ABAP Structures and ABAP Logical Expressions
 
oracle-reports6i
oracle-reports6ioracle-reports6i
oracle-reports6i
 
Dbms sql-final
Dbms  sql-finalDbms  sql-final
Dbms sql-final
 
Error-Bar_Charts.pdf
Error-Bar_Charts.pdfError-Bar_Charts.pdf
Error-Bar_Charts.pdf
 
Pl sql best practices document
Pl sql best practices documentPl sql best practices document
Pl sql best practices document
 
R04 - Basics of Reporting: Report Setup Part 2
R04 - Basics of Reporting: Report Setup Part 2 R04 - Basics of Reporting: Report Setup Part 2
R04 - Basics of Reporting: Report Setup Part 2
 
Pandas csv
Pandas csvPandas csv
Pandas csv
 
Programming-in-C
Programming-in-CProgramming-in-C
Programming-in-C
 
SPSS an intro...
SPSS an intro...SPSS an intro...
SPSS an intro...
 

Recently uploaded

Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
roli9797
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
Lars Albertsson
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
g4dpvqap0
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023
kuntobimo2016
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
apvysm8
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
nyfuhyz
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
dwreak4tg
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 

Recently uploaded (20)

Analysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performanceAnalysis insight about a Flyball dog competition team's performance
Analysis insight about a Flyball dog competition team's performance
 
End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024End-to-end pipeline agility - Berlin Buzzwords 2024
End-to-end pipeline agility - Berlin Buzzwords 2024
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
一比一原版(爱大毕业证书)爱丁堡大学毕业证如何办理
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023State of Artificial intelligence Report 2023
State of Artificial intelligence Report 2023
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
一比一原版(UMN文凭证书)明尼苏达大学毕业证如何办理
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
一比一原版(BCU毕业证书)伯明翰城市大学毕业证如何办理
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 

A Step-By-Step Introduction to SAS Report Procedure

  • 2. Learning Objectives • Create a listing report • Select columns for your report • Define the usage for columns • Specify attributes, options, and justification for columns • Specify features of column headings, including split characters, underlining, and blank lines.
  • 3. Features  PROC REPORT enables you to • create listing reports • create summary reports • enhance reports • request separate subtotals and grand totals • calculate columns • generate reports in an interactive point-and-click or programming environments.
  • 4. Creating a Default List Report General form of a simple PROC REPORT step: PROC REPORT <DATA=SAS-data-set> <options>; RUN; Options includes: WINDOWS | WD invokes the procedure in an interactive REPORT window (default). NOWINDOWS | NOWD displays the report in the OUTPUT window.
  • 5. Sample Data used for reporting • The mylib.fitness dataset contains the medical records for a sample of patients. • This dataset contains variables such as PatID, First_Name, Last_Name,Gender, Age, Height, Weight,Smoking,and Race.
  • 6. Creating a Default List Report proc report data=mylib.fitness ; run; proc report data=mylib.fitness nowd; run; SAS Listing Output
  • 7. Creating a Default List Report SAS HTML Output:
  • 8. The REPORT Procedure  The PROC Report displays • each data value the way it is stored in the data set, or formatted value if a format is stored with the data • variable names or labels as report column headings • a default width for the report columns • character values left-justified • numeric values right-justified • observations in the order in which they are stored in the data set.
  • 9. Selecting Variables Use a COLUMN statement to select and order the variables that appear in the report. General form of the COLUMN statement: COLUMN variable(s); where variable(s) is one or more variable names, separated by blanks.
  • 10. Selecting Variables proc report data=mylib.fitness nowd ; column patid gender age height_cm weight_kg; run; SAS Output
  • 11. Selecting Observations  Use WHERE statement to select the observations for your report. proc report data=mylib.fitness nowd; column patid gender race age height_cm weight_kg; where race in ('Black' ,'Asian'); run; SAS Output Displays only the records where race is Black or Asian
  • 12. The DEFINE Statement  You can enhance the report by using DEFINE statements to • define how each variable is used in the report • assign formats to variables • specify column headings and column widths • justify the variable values and column headings within the report columns • change the order of the rows in the report.
  • 13. The DEFINE Statement General form of the DEFINE statement: DEFINE variable / <usage> <attribute(s)> <option(s)> <justification> <'column-heading'> ; Where, • variable is the name of the variable to define. • usage specifies how to use the variable. Valid options are ACROSS, ANALYSIS, COMPUTED, DISPLAY, GROUP, and ORDER. • attribute(s) specifies attributes for the variable, including FORMAT=, WIDTH=, and SPACING=. • option(s) specifies formatting options, including DESCENDING, NOPRINT, NOZERO, and PAGE. • <justification> specifies column justification (CENTER, LEFT, or RIGHT). • 'column-heading' specifies a label for the column heading.
  • 14. Defining Column Attributes If there is a format stored in the descriptor portion of the data set, it is the default format. The default column width is, • the variable’s length for character variables • 9 for numeric variables • the format width if there is a format stored in the descriptor portion of the data set. WIDTH= column-width : specifies the width of a column. FORMAT= format : assigns a format to a variable.
  • 15. Defining Column Attributes If there is a label stored in the descriptor portion of the data set, it is the default header. ‘report-column-header’ : defines the column header. SPACING= horizontal positions : Specifies how many blank characters to leave between the selected column and the column immediately to its left. The default is 2.
  • 16. Defining Column Attributes 1. Add format to display height and weight with decimals. 2. Increase the column widths 3. Increase the spacing 4. Change column headings proc report data=mylib.fitness nowd; column patid gender age height_cm weight_kg; define patid/'Patient ID'; define height_cm / format =6.2 width=11 spacing=5 'Height (cm)'; define weight_kg / format=5.2 width=11 spacing=5 'Weight (kg)'; run;
  • 17. Defining Column Attributes SAS Listing Output SAS HTML Output Note: Width and spacing attributes in the Define statement has no effect on HTML output.
  • 18. Splitting Column Headings across Multiple Lines To split character, • Use the default slash (/) as the split character. • Define a split character by using the SPLIT= option in the PROC REPORT statement. proc report data=mylib.fitness nowd; column patid gender age height_cm weight_kg; define patid/'Patient ID'; define height_cm / format =6.2 width=6 spacing=5 'Height/(cm)'; define weight_kg / format=5.2 width=6 spacing=5 'Weight/(kg)'; run;
  • 19. Splitting Column Headings across Multiple Lines SAS Output:
  • 20. Specifying Column Justification To specify justification, add option CENTER, LEFT, or RIGHT in the DEFINE statement. proc report data=mylib.fitness nowd split='*'; column patid gender age height_cm weight_kg; define patid/'Patient ID' left; define age/ center; define height_cm / format =6.2 width=6 spacing=5 'Height*(cm)' center; define weight_kg / format=5.2 width=6 spacing=5 'Weight*(kg)' center; run;
  • 22. Enhancing the Heading’s Appearance • HEADLINE : underlines all column headings and the spaces between them. • HEADSKIP : writes a blank line beneath all column headings or after the underline if the HEADLINE option is used. These options have no effect on HTML output. proc report data=mylib.fitness nowd headline headskip; column patid gender age height_cm weight_kg; define patid/'Patient ID'; define height_cm / format =6.2 width=6 spacing=5 'Height/(cm)'; define weight_kg / format=5.2 width=6 spacing=5 'Weight/(kg)'; run;
  • 23. Enhancing the Heading’s Appearance SAS Output:
  • 24. Variable Usage PROC REPORT uses each variable in one of six ways, • DISPLAY • ORDER • GROUP • ACROSS • ANALYSIS • COMPUTED By default, PROC REPORT uses, • character variables as display variables • numeric variables as analysis variables, which are used to calculate the SUM (default) statistic.
  • 25. Defining Order Variables ORDER : orders the rows in the report. • Orders the report in ascending (default) order. Include the DESCENDING option in the DEFINE statement to force the order to be descending. • Suppresses repetitious printing of values. • Does not need data to be previously sorted. proc report data=mylib.fitness nowd ; column gender patid age height_cm weight_kg smoking race; define gender/order width=6; define patid/ 'Patient ID' width=10 left; define age/ width=3 center; define height_cm / format =6.2 width=11 spacing=5 'Height/(cm)' center; define weight_kg / format=5.2 width=11 spacing=5 'Weight/(kg)' center; run;
  • 26. Defining Order variables SAS Output: Displays the data in order by Gender.
  • 27. Defining Group Variables  Use the REPORT procedure to create a summary report by defining variables as group variables.  To define a group variable, specify the GROUP usage option in the DEFINE statement.  All observations whose group variables have the same values are collapsed into a single row in the report.  You can define more than one variable as a group variable.  Nesting of group variables is determined by the order of the variables in the COLUMN statement.  If you have a group variable, there must be no display or order variables.  Group variables produce summary reports (observations collapsed into groups).  Display and order variables produce listing reports(one row for each observation).
  • 28. Defining Group Variables proc report data=mylib.fitness nowd ; column gender smoking weight_kg ; define gender/group width=6; define smoking/group width=7; define weight_kg / format=5.2 width=11 'Weight/(kg)' center; run; SAS Output Displays the total weight gender wise and smoking habit wise Note: The default statistic for the analysis variables is SUM.
  • 29. Defining Analysis Variables • The default statistic for analysis variables is SUM. • To specify a statistic other than SUM (default), specify the statistic as an attribute in the DEFINE statement • Below are the few statistics that can be used in Proc Report; N Number of nonmissing values MEAN Average value MIN Minimum value MAX Maximum value STD Standard Deviation
  • 30. Defining Analysis Variables proc report data=mylib.fitness nowd ; column gender smoking height_cm weight_kg; define gender/group width=6; define smoking/group width=7; define height_cm / mean format =6.2 width=19 spacing=5 'Average Height/(cm)' center; define weight_kg / mean format=5.2 width=19 spacing=5 'Average Weight/(kg)' center; run; SAS Output
  • 31. Defining Across Variables • Variables can also be defined as Across variables which are functionally similar to group variables. However, PROC REPORT displays the groups that it creates for an across variable horizontally rather than vertically. proc report data=mylib.fitness nowd ; column gender smoking height_cm weight_kg; define gender/across width=6; define smoking/across width=7; define height_cm / mean format =6.2 width=19 spacing=5 'Average Height/(cm)' center; define weight_kg / mean format=5.2 width=19 spacing=5 'Average Weight/(kg)' center; run;
  • 32. Defining Across Variables SAS Output: Notes: • For each across variable, the table cells contain a frequency count for each unique value. • For each analysis variable, the table cells represent the sum of all the variable's values.
  • 33. Defining Computed Variables  Computed variables are the new variables that you define for the report. They are not present in the input dataset.  Computed variables can be either numeric or character variables.  You cannot change the usage of a computed variable.  To add a computed variable in Proc Report, • Include the computed variable in the COLUMN statement. • Define the variable's usage as COMPUTED in the DEFINE statement. • Compute the value of the variable in a compute block that is associated with the variable.  The position of a computed variable is very important. You can't base the calculation of a computed variable on any variable that appears to its right in the report. So in COLUMN statement specify the computed variable to the right of the variables that are used in its calculation.
  • 34. Defining Computed Variables proc report data=mylib.fitness nowd ; column first_name last_name gender race age smoking weight_kg height_cm bmi; define first_name/'First Name' width=10; define last_name/'Last Name' width=9; define smoking/width=7; define height_cm / format =6.2 width=6 'Height (cm)'; define weight_kg / format=5.2 width=6 'Weight (kg)'; define bmi / computed 'Body Mass Index' format=5.2 width=15; compute bmi; bmi= weight_kg.sum/(height_cm.sum*0.01)**2; endcomp; run; Computed variable
  • 35. Defining Computed Variables SAS Output: Computes the variable Body Mass Index using weight and height data.