SAS for Categorical Data Copyright © 2004 Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright.

Slides:



Advertisements
Similar presentations
MY NCBI (module 4.5). MODULE 4.5 PubMed/How to Use MY NCBI Instructions - This part of the: course is a PowerPoint demonstration intended to introduce.
Advertisements

MY NCBI (module 4.5).
10. NLTS2 Documentation Overview. 1 Prerequisites Recommended modules to complete before viewing this module  1. Introduction to the NLTS2 Training Modules.
Simple Logistic Regression
Final Thoughts HRP 223 – 2013 December 4 th, 2013 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
Today: Run SAS programs on Saturn (UNIX tutorial) Runs SAS programs on the PC.
Working with Data in Windows HRP223 – 2010 October 4 th, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 SAS Formats and SAS Macro Language HRP223 – 2011 November 9 th, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
SAS Output Delivery System. Find heart in the sashelp library Double click.
Beginning Data Manipulation HRP Topic 4 Oct 19 th 2011.
1 Merging with SQL HRP223 – 2011 October 31, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
1 Lab 2 HRP223 – 2010 October 18, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
1 Processing Grouped Data HRP223 – 2011 November 14 th, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 Combining (with SQL) HRP223 – 2010 October 27, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
1 Creating and Tweaking Data HRP223 – 2010 October 24, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 Database Theory and Normalization HRP223 – 2010 November 14 th, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
1 Lab 1 HRP223 – 2011 Oct 10, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
© Copyright 2000, Julia Hartman 1 An Interactive Tutorial for SPSS 10.0 for Windows © by Julia Hartman Binomial Logistic Regression Next.
1 An Introduction to IBM SPSS PSY450 Experimental Psychology Dr. Dwight Hennessy.
Biostatistical Methods II PubH 6415 Spring PubH 6415 – Biostatistics I Instructor: Susan Telke (office hours: lecture.
Mean Comparison With More Than Two Groups
Two-Way ANOVA in SAS Multiple regression with two or
Welcome to the Exciting World of ! Lessons to familiarize yourself with.
SPSS 1: An Introduction to the Statistical Package SPSS Suzie Cro MRC Clinical Trials Unit.
1 Windows and Beginning Data Manipulation HRP223 – 2013 Oct 9, 2012 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
CPG 453 Course Outline Previous Text:  Microsoft Office XP – Illustrated Introductory (Enhanced Edition) by Thomson Course Technology (2003)  This.
Building a XanEdu CoursePack Copyright 2004 ProQuest Information and Learning Company. All rights reserved.
SAS Workshop Lecture 1 Lecturer: Annie N. Simpson, MSc.
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
Higher Order Contingency Tables and Logistic Regression Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Introduction to SAS BIO 226 – Spring Outline Windows and common rules Getting the data –The PRINT and CONTENT Procedures Manipulating the data.
A fill-in-the-blank tool that guides you through picking a topic, searching the Internet, gathering good Internet links, and turning them into online learning.
HPR Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Working with Data in Windows HRP223 – 2009 Sept 28 th, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
SAS 介绍和举例 Presented by 经济实验教学中心 商务数据挖掘中心. Raw Data Read in Data Process Data (Create new variables) Output Data (Create SAS Dataset) Analyze Data Using.
1 Lab 2 and Merging Data (with SQL) HRP223 – 2009 October 19, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
CIITS Institute: Creating District Curriculum & Materials Copyright © 2012 Schoolnet, Inc. All rights reserved.
Getting Started With Stata Session 1 Jim Anthony John Troost Department of Epidemiology Michigan State University.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
1 Lab 1 HRP223 – 2011 Oct 10, 2011 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
Copy of the from the secure website - click on the AccoridaLife.zip link.
1 Lab 1 HRP223 – 2009 October 5, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
D2L Orientation Marriage and the Family FCS 320 or SOC Sacramento City College- Jo-Ann Foley.
HRP 223 – 2007 lm.ppt - Linear Models Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
1 EPIB 698C Lecture 1 Instructor: Raul Cruz-Cano
SAS Programming Training Instructor:Greg Grandits TA: Textbooks:The Little SAS Book, 5th Edition Applied Statistics and the SAS Programming Language, 5.
Beginning Data Manipulation HRP Topic 4 Oct 14 th 2012 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
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 Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
Introduction to SPSS 16.0 Part 2
Working with Data in Windows
SAS Output Delivery System
Combining (with SQL) HRP223 – 2013 October 30, 2013
Lab 3 and HRP259 Lab and Combining (with SQL)
Lab 2 and Merging Data (with SQL)
Combining (with SQL) HRP223 – 2012 November 05, 2011
Lab 2 HRP223 – 2010 October 18, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
File Sharing and Processing Grouped Data
Data Manipulation (with SQL)
Processing Grouped Data
Presentation transcript:

SAS for Categorical Data Copyright © 2004 Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international treaties. Unauthorized reproduction of this presentation, or any portion of it, may result in severe civil and criminal penalties and will be prosecuted to maximum extent possible under the law.

SAS  SAS is a huge integrated data management and analysis suite. It takes years to master 20% of SAS. Most people take weeks if not months to get comfortable working with it.  The course I teach has online slides which demonstrate how to do categorical data analyses as well as data management. Topic 0 has information on using SAS as a calculator.

Using SAS  When you start SAS in a windowing environment you automatically have access to at least 4 windows. The (enhanced) program editor is a place where you type instructions to SAS. The log window gives you feedback on how SAS interprets your work. The output window displays any printed results from your request. There is also a two pained window. One, Explorer, allows you to look at data sets. The other, Results, acts like a hyperlinked table of contents for the output window.

Telling SAS what to do.  You type instructions in the program editor and then push the run button.  The instructions you will use for this class will be data steps (to create data sets) and procedures (to analyze data sets).

Data steps  In data steps you can create variables (a variable is just like a box that can hold either numbers or letters). You can do math on variables including using functions that are build into SAS. data work.someData; theAnswer = 1 + 1; run;  After you type the instructions you have to tell SAS to actually do the work. Push the running person icon to do this.

Data steps  The above code will create a data set that will exist until you quit SAS. You can view it as if it was a spreadsheet by double clicking on Libraries then the Work library and finally the data set inside the SAS Explorer window.

Functions  SAS has thousands of functions built in: data work.blah; numberOne = 1; someTrigThing = sin(numberOne); run;  I have tried to document the ones that students frequently need in Lecture 2 of 223. Take a look at the slides labeled Frequently Used Functions.

Finding fuctions  … or you can look up the function in the SAS online documentation.  One of the useful links in the useful links section of the class website is the SAS online documentation.  The URL of SAS OnLineDoc is:  If you enter a bad password 3 times and it will take you to the registration page. Access to the documentation is free.

Example of a Function  If you roll a die 50 times what's the chance that you'll get more than 10 "6"'s? data work.pfft; x = 1 - CDF('BINOMIAL',10, 1/6, 50) ; run;

Procedures  SAS has many built in statistical analysis procedures. The ones you will use for this class are: proc freq – contingency tables  See 223 topics 12 and 13 proc logistic – logistic regression  See 223 topics 14 and 15

Real data looks like this:  data work.epi;  input subjectID exposure $ disease $;  datalines;  1 exposed Diseased  2 exposed Diseased  3 exposed Diseased  4 exposed Diseased  5 exposed notDiseased  6 notExposed notDiseased  7 exposed Diseased  8 exposed Diseased  9 exposed Diseased  10 notExposed notDiseased  11 exposed notDiseased  12 exposed Diseased  13 notExposed Diseased  14 notExposed notDiseased  15 exposed Diseased  16 exposed Diseased  17 exposed notDiseased  18 notExposed notDiseased  19 exposed Diseased  20 exposed Diseased  21 exposed Diseased  22 notExposed notDiseased  23 exposed notDiseased  24 exposed Diseased  25 notExposed notDiseased  26 exposed notDiseased  27 notExposed notDiseased  28 exposed Diseased  ; run;

Contingency tables  You can get a frequency table like this: proc freq data = work.epi; tables exposure * disease; run;

Contingency tables analysis proc freq data= epi; tables exposure*disease /chisq; run;

Grouped Data  You will get grouped data in statistics classes…  In a case-control study of 50 patients with pancreatic cancer and 50 hospital controls, 15 patients and 25 controls are non-coffee-drinkers, 15 patients and 10 controls are mid-level coffee drinkers, and 20 patients and 15 controls are high-octane coffee addicts. What are the odds ratios for the association between coffee drinking and pancreatic cancer (comparing high to low, high to none, low to none, and any to none)?

Grouped Data data work.epi; input exposure $ disease $ people; datalines; notExposed diseased 15 notExposed notDiseased 25 little diseased 15 little notDiseased 10 lots diseased 20 lots notDiseased 15 ; run;

Problems… proc freq data = epi; tables exposure * disease; run;

Weighted data proc freq data = epi; weight people; tables exposure * disease; run;

Analysis of weighted data proc freq data = epi; weight people; tables exposure * disease /relrisk; where exposure in ("notExpos", "lots"); run;

Other groups  Just copy and paste the proc freq and pick different groups.  To get the combined groups use a character format (if you took 223) or just add the two exposed groups by hand.

Formats in Freq proc format; value $coffee "lots" = "Exposed" "little" = "Exposed" "notExpos" = "notExpos" ; run; proc freq data = epi; weight people; format exposure $coffee.; tables exposure * disease /relrisk; run;

Analysis of Formatted Grouped Data