HPR223 2008 Copyright © 1999-2008 Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.

Slides:



Advertisements
Similar presentations
Objectives 1.Identify the functions of a spreadsheet 2.Identify how spreadsheets can be used. 3.Explain the difference in columns and rows. 4.Locate specific.
Advertisements

HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Final Thoughts HRP 223 – 2013 December 4 th, 2013 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
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 Lab 1 HRP223 – 2010 October 6, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
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.
1 An Introduction to IBM SPSS PSY450 Experimental Psychology Dr. Dwight Hennessy.
A Simple Guide to Using SPSS© for Windows
XP New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 11 1 Microsoft Office Excel 2003 Tutorial 11 – Importing Data Into Excel.
 The Law of Large Numbers – Read the preface to Chapter 7 on page 388 and be prepared to summarize the Law of Large Numbers.
Introduction to Excel 2007 Part 3: Bar Graphs and Histograms Psych 209.
1 Windows and Beginning Data Manipulation HRP223 – 2013 Oct 9, 2012 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
SAS for Categorical Data Copyright © 2004 Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright.
1 Access Lesson 1 Microsoft Access Basics Microsoft Office 2010 Introductory.
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.
Analysing your data PsychoPy saves several data files for different uses: A Microsoft Excel (spreadsheet) file that you can use for most analyses A ‘psydat’
1 Data List Spreadsheets or simple databases - a different use of Spreadsheets Bent Thomsen.
PHP meets MySQL.
Working with Data in Windows HRP223 – 2009 Sept 28 th, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Computational Biology, Part 12 Spreadsheet Basics I Robert F. Murphy Copyright  1996, All rights reserved.
Database Systems Microsoft Access Practical #3 Queries Nos 215.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
1 Lab 2 and Merging Data (with SQL) HRP223 – 2009 October 19, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
1 Summary HRP223 – 2009 November 1 st, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
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.
1 Chapter 3: Getting Started with Tasks 3.1 Introduction to Task Dialogs 3.2 Creating a Listing Report 3.3 Creating a Frequency Report 3.4 Creating a Two-Way.
1 Lab 1 HRP223 – 2009 October 5, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
1 PEER Session 02/04/15. 2  Multiple good data management software options exist – quantitative (e.g., SPSS), qualitative (e.g, atlas.ti), mixed (e.g.,
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.
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.
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 16 & 17 By Tasha Chapman, Oregon Health Authority.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
CS 106 Computing Fundamentals II Chapter 5 “Excel Basics for Windows”
Working with Data in Windows
SAS Output Delivery System
Combining (with SQL) HRP223 – 2013 October 30, 2013
Working with Data in Windows and Descriptive Statistics
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.
From and Report.
Exploring Microsoft Office Access 2010
Lab 1 HRP223 – 2009 October 5, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
A Bit About SAS/Macro Language Database Theory and Normalization
File Sharing and Processing Grouped Data
Data Manipulation (with SQL)
Processing Grouped Data
Access Lesson 1 Microsoft Access Basics
Presentation transcript:

HPR Copyright © 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. HRP Topic 4 – Making and Looking at Data

HPR Toy Data  While it is of little use in real life, SAS lets you manually enter data.  First make a library so the data will be permanently stored.

HPR Toy Data  Tell it to make the dataset:

HPR

If you type a number as the first value of a character variable, EG converts the column to numeric. Right click on the column headings to change them back if this inadvertently happens.

HPR Professional programmers equate 0 with “no” and 1 means “yes” but create a format to make reports pretty.

HPR Open the data, then set it to be not read only by unchecking the option.

HPR When you come back…  If you return to the project it will have forgotten about the formats you applied.  Add a one line program to tell it what libraries (folders) have formats stored in them. This little program shows the details on formats in a library.

HPR These 4 records really represent 300 people. So if you were to do a frequency count on the cancer name variable, you would get the wrong count. Notice that it uses the labels.

HPR If you find the label “The FREQ Procedure” annoying, turn it off in the options Tasks > Tasks General pane. This is the same as the code: ods noproctitle; You can also set or remove default titles and footnotes here.

HPR Fix the title also:

HPR Setting the Order  There are options to set the order that the results print. If the options don’t work, make a format.

HPR Ordering the Information  When data is sorted in format order, the first “letter” of the alphabet is blank. So put a leading space in the format for the things you want listed first. I added a leading blank before the Y

HPR One format is numeric. The other format is character.

HPR Two Categorical Variables  You can do similar voodoo with two categorical variables: … no idea why Frequency count shows first on the task roles.

HPR Specify What is a Row vs. a Column  Drag your outcome variable over first.  Drag the exposure variable over second. First

HPR The character variable lists No before Yes.

HPR Notice the leading space before the Y. You could go back and manually change the format by clicking on the column heading in the data set but I recommend just applying it in the analysis. This will replace values in a character variable so this a character format.

HPR Be aware that all the common statistics are here so you do not need to learn the code. Use the Preview code button to see if you have the right options set.

HPR Summarizing Numeric Data  Begin with a graphic. – Remember that you want to show both central tendency and variability. – You have already briefly seen the Summary Statistics and Distribution Analysis menu options (aka proc means and proc univariate).  I want you to know how to summarize large and small datasets.

HPR Numeric Data  Say somebody tells you to simulate rolling dice. The formula to do this says: – generate a random number between 0 and 1 – multiply it by 6 – round up to the closest integer data die; *the 22 says which list of numbers between 0 & 1; aNumber = ranuni(22); die = ceil(6*aNumber); * Generate a random integer between 1 and 6.; dieDie = ceil(6*ranuni( )); output; * write to the new dataset; return; * go to the top and try to read in data; run;

HPR Doing Stuff Repeatedly  How to roll two dice: data dice; do x = 1 to 2 by 1; roll= ceil(6*ranuni( )); output; end; return; * go to the top and try to read in data; run;

HPR Craps…  In the dice game “craps” you throw two dice and the number you roll determines if you win or lose. How do you simulate rolling 10 pairs of dice? data craps ; do trial = 1 to 10; do dieNumber = 1 to 2; roll = ceil(6*ranuni( )); output; end; return; run;

HPR The Total  Calculate the sum across the rolls using Summary Statistics on the Describe menu.

HPR Total on a Trial

HPR Do the histogram on the summary data.

HPR Crank up the number of simulations. Turn off the histograms for each trial. Generate a histogram based on the 1000 trials. I want to fix the way the histogram is binned. When the code is open, push any key and it will make a copy of the code which you can edit.

HPR

Do Loops  Loops are used whenever you need to repeatedly do something. Say you wanted to read in 24 lines of data, where the first 6 records are from 1 treatment, the next 6 are from a 2 nd, etc.

HPR More Condensed  The group could be a counter that goes from 1 to 4.

HPR How to Summarize  You can get a boxplot or a histogram with only 6 values but they will not be very informative.

HPR

Only a Few  If you only have a few data points, you should consider a mean and dot plot. SAS doesn’t have one built in so I made a macro to do it.  Macros are self contained blocks of code that do complex things. – A good Macro is like a function. You pass it a few arguments and it returns an answer. You don’t need to look at how its guts work.

HPR The plotit Macro  You paste in the macro beginning with the macro line and ending in the mend line.  Then you invoke the macro using the name following the %macro statement:

HPR

Macro Stuff  Macros can do simple formulas like calculating an age.  Or really ugly stuff like validating dates.

HPR

Function Help  The books for the class have lists of frequently used functions but you probably want to bookmark the function help in EG as well as using onlineDoc.

HPR Add it to the favorite page.  Highlight a word in the right windowpane and then type control-f to find words.

HPR Dummy records in the HW  Recall there was a dummy record at the beginning of the Homework datasets. Why? – Columns of data in Excel are allowed to take arbitrary widths. So if you have a “last-name” column it will import into a database as having the width of the longest name. – If you import a second dataset and it has a different length and you try to append them together a database will choke. – You can use a dummy record to make sure the columns have the same length.

HPR Combine two datasets

HPR