Beginning Data Manipulation HRP 223 - Topic 4 Oct 14 th 2012 Copyright © 1999-2013 Leland Stanford Junior University. All rights reserved. Warning: This.

Slides:



Advertisements
Similar presentations
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
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.
Working with Data in Windows and Descriptive Statistics HRP223 – Topic 2 October 5 th, 2011 Copyright © Leland Stanford Junior University. All.
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.
Final Thoughts. When you get data… Check for Viruses Lock the files – Right click> properties>click on read only Assume the data has not been cleaned.
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.
Working with Data in Windows and Descriptive Statistics HRP223 – Topic 2 October 2 nd, 2013 Copyright © Leland Stanford Junior University. All.
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.
Welcome to SAS…Session..!. What is SAS..! A Complete programming language with report formatting with statistical and mathematical capabilities.
An Introduction to Textual Programming
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.
A453 Exemplar Password Program using VBA
Automating Tasks with Visual Basic. Introduction  When can’t find a readymade macro action that does the job you want, you can use Visual Basic code.
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
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.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 8 Dental Payment Application Introducing CheckBox es and Message Dialogs.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
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.
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.
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
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 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.
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
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
Whatcha doin'? Aims: To start using Python. To understand loops.
CprE 185: Intro to Problem Solving (using C)
Unit 16 – Database Systems
GO! with Microsoft Office 2016
Working with Data in Windows
SAS Output Delivery System
The relational operators
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.
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)
Working with Data in Windows and Descriptive Statistics
Final Thoughts.
Processing Grouped Data
Presentation transcript:

Beginning Data Manipulation HRP Topic 4 Oct 14 th 2012 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.

What I am working on I had an idea for a graphic... It is a totally custom picture so I needed fake data.

Fake data... and real graphics code

Real Graphic with Fake Data

Some fake data Procedures Functions Procedures summarize over a dataset Functions work on a within a record of a dataset. Notice SAS remembers the capitalization

Print a Dataset

What SAS writes

Labels fix these Formats fix these I changed the capitalization.

Turning Labels On for Browsing Tables I typically keep this off. I want to see the real names for writing code.

Average months treatment Calculate a mean

Average 3 labs Search the function list in onlineDoc for a function that does average.

Modifying datasets with SQL

I like to split my.egp file into several process flowcharts. One sets the libraries and formats. One does cleaning. One (or several) for analyses. Right click here and choose Properties. Label this process flow Make data. Note the name.

Note the new name.

Automatically Make Libraries and/or Formats You can make a process flow that runs whenever you start up your project. Just name the process flow autoexec.

User Defined Formats I typically create my formats with code but if you want to use the GUI.

Set this A short name

After pushing Run fix the node name to match the format.

Make At Least 1 Analysis Process Flow If you have an autoexec file you don’t need to include the library in the analysis sheet but I like to see it:

Moving Between Process Flows Here Or here

Need a new variable? You can check a value using an if statement in a data step:

else If the value is not greater than or equal to 175 then set the result to be good: New character variables are 8 letters wide if you use an input statement. Otherwise it uses the first reference to set the length. It gets the length for existing variables from the first reference in the source dataset.

Change this to "Bad " or use a length statement.

Missing values are negative infinity….

You can get the same result with SQL.

Showing Combinations Often I am asked to show sets of treatments or sets of drugs. This quickly gets too complex for contingency tables (for 5 treatments you need 2x2x2x2x2 tables). I use binary lists. For example, common cancer treatments include Chemo, Radiation, Surgery (but you can use this same system for fine distinctions). Somebody who got Chemo and Surgery but no radiation can be represented as CrS. Code everybody like that and count the combinations.