Proc Means, Exams of Statistics

Introduction to PROC Means. 2. Integrating PROC Means with MS Excel. 3. Using PROC Means for 'Data Manipulation'. Overview ...

Typology: Exams

2022/2023

Uploaded on 03/01/2023

ekaksha
ekaksha 🇺🇸

4.4

(30)

268 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Proc Means
The Friendliest PROC
Jayson H. Shurgold
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Proc Means and more Exams Statistics in PDF only on Docsity!

Proc Means The Friendliest PROC Jayson H. Shurgold

  1. Introduction to PROC Means
  2. Integrating PROC Means with MS Excel
  3. Using PROC Means for ‘Data Manipulation’

Overview

Data

PROC

Line by line instructions primarily used to manipulate data Pre-existing programs that generate specific outcomes

PROC SQL PROC SQL

PROC Means

  • One of the oldest and most widely used PROC functions
  • Used to analyze and summarize numeric data
  • Able to stratify statistics by classification
  • Able to output to datasets Default Statistics N MEAN STD MAX MIN

PROC Means Example 1

PROC MEANS Data=Library.Example1 N Mean Median Min Max MaxDec = 2; VAR Age; CLASS Gender; WHERE BirthYear = 1990 ; RUN; Specify the dataset Custom Statistics^ Provide only 2 Decimals Specify the analysis variable Specify stratifications Specify conditions

Calculate average age by gender for participants born in 1990

PROC Means Example 1

PROC MEANS Data=Library.Example1 N Mean Median Min Max MaxDec = 2; VAR Age; CLASS Gender; WHERE BirthYear = 1990 ; RUN; Must be numeric data Note the difference between ‘CLASS’ and ‘BY’ Can be any existing TEXT or NUMERIC data Can use derived conditions using functions WHERE YEAR(DateOfBirth)=

Calculate average age by gender for participants born in 1990

Integrating PROC Means with MS Excel

  • Analysts are often asked to provide data summaries to investigators in MS Excel
  • Copy and paste does not work well
  • Manual transcription is time consuming and prone to errors

PROC Means Example 2 – Part 1

PROC MEANS Data=Library.Example2 N Mean Median Min Max Noprint nway; VAR Age; CLASS Gender; WHERE BirthYear = 1990 ; OUTPUT out = Example2_Result (drop= TYPE FREQ) n = Mean = Median = Min = Max = / autoname; RUN;

Calculate average age by gender for participants born in 1990

Present in Excel

PROC Means Example 2 – Part 1

Calculate average age by gender for participants born in 1990

Present in Excel

Without NOINHERIT Without NWAY With NOINHERIT With NWAY

FILENAME DDE_Dataset DDE “Excel|Sheet1!r3c3:r4c7” notab; DATA NULL; SET Example2_Result FILE DDE_Dataset PUT n ‘09’x mean ‘09’x median ‘09’x Min ‘09’x Max; RUN;

PROC Means Example 2 – Part 2

Calculate average age by gender for participants born in 1990

Present in Excel

PROC Means Example 2

Calculate average age by gender for participants born in 1990

Present in Excel

PROC MEANS Data=Library.Example2 N Mean Median Min Max Noprint Nway; VAR Age; CLASS Gender; WHERE BirthYear = 1990 ; OUTPUT out = Example2_Result (drop= TYPE FREQ) n = Mean = Median = Min = Max = / autoname; RUN; FILENAME DDE_Dataset DDE “Excel|Sheet1!r3c3:r4c7” notab; DATA NULL; SET Example2_Result FILE DDE_Dataset PUT n ‘09’x mean ‘09’x median ‘09’x Min ‘09’x Max; RUN;

PROC Means Example 2

Calculate average age by gender for participants born in 1990

Present in Excel

PROC Means for ‘Data Manipulation’

  • PROC Means can be an easy to use and efficient way to create 1:1 analysis datasets from ∞:1 datasets Consider a prospective cohort study, investigating specific behavioural patterns among spinal cord injury patients, where participants are interviewed every 6 months following injury. Data Elements:
    • ID Unique ID repeated for each interview
    • InterviewDate Date of interview
    • Age / Gender Age and Gender at interview
    • Pain [Yes / No] of a specific type of pain
    • Independence_score Numeric score reflecting independence
    • Behaviour1 [Yes / No] of a specific behaviour

PROC Means for ‘Data Manipulation’

  • PROC Means Example
  • Calculate average age by gender for participants born in
  • ID InterviewDate Age Gender Pain Independence_Score Behaviour
  • 1 01/12/2012
  • 1 01/06/2013
  • 1 01/12/2013
  • 1 01/06/2014
  • 1 01/12/2014
  • 2 01/12/2012
  • 2 01/06/2013
  • 2 01/12/2013
  • 2 01/06/2014
  • 2 01/12/2014
  • 3 01/12/2012
  • 3 01/06/2013
  • 3 01/12/2013
  • 3 01/06/2014
  • 4 01/12/2013
  • 4 01/06/2014
  • 4 01/12/2014
  • 5 01/12/2011
  • 5 01/06/2012
  • 5 01/12/2012
  • 5 01/06/2013
  • 5 01/12/2013
  • 5 01/06/2014
  • 5 01/12/2014