Beginning Data Manipulation HRP 223 - Topic 4 Oct 19 th 2011.

Slides:



Advertisements
Similar presentations
Chapter 4 Computation Bjarne Stroustrup
Advertisements

Microsoft® Small Basic
Statistical Methods Lynne Stokes Department of Statistical Science Lecture 7: Introduction to SAS Programming Language.
Statistics in Science  Introducing SAS ® software Acknowlegements to David Williams Caroline Brophy.
Homework 1 Hints. Homework Tips (General) Go through and do the ENTIRE homework in the same time period – You will use all of the material from chap 1.
Working with Data in Windows HRP223 – 2010 October 4 th, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
SAS Output Delivery System. Find heart in the sashelp library Double click.
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 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.
Classes, methods, and conditional statements We’re past the basics. These are the roots.
SAS for Categorical Data Copyright © 2004 Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright.
MS Access: Database Concepts Instructor: Vicki Weidler.
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.
A453 Exemplar Password Program using VBA
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.
Different Decimal Places For Different Laboratory Tests PharmaSug 2004, TT01 A. Cecilia Mauldin.
IPC144 Introduction to Programming Using C Week 1 – Lesson 2
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.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
Multiple Uses for a Simple SQL Procedure Rebecca Larsen University of South Florida.
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.
Chapter 1: Introduction to SAS  SAS programs: A sequence of statements in a particular order  Rules for SAS statements: –Every SAS statement ends in.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
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:
1 Data Manipulation (with SQL) HRP223 – 2010 October 13, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Decision Structures, String Comparison, Nested Structures
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.
CHAPTER EIGHT ARRAYS © Prepared By: Razif Razali1.
Controlling Program Flow with Decision Structures.
HRP Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and.
1 Data Manipulation (with SQL) HRP223 – 2009 October 12, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This.
Chapter 6: Modifying and Combining Data Sets  The SET statement is a powerful statement in the DATA step DATA newdatasetname; SET olddatasetname;.. run;
An Introduction to Programming with C++ Sixth Edition Chapter 5 The Selection Structure.
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.
General Condition Loop A general condition loop just loops while some condition remains true. Note that the body of the loop should (eventually) change.
Loops ( while and for ) CSE 1310 – Introduction to Computers and Programming Alexandra Stefan 1.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 5 & 6 By Ravi Mandal.
Some Assignments  Write a program which prints the following information about at least 5 persons: NAME MAIL-ID EMPLOYEE-CODE PHONE Eg. Umesh
Whatcha doin'? Aims: To start using Python. To understand loops.
CprE 185: Intro to Problem Solving (using C)
The Selection Structure
Working with Data in Windows
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Decision Structures, String Comparison, Nested Structures
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha
Decision Structures, String Comparison, Nested Structures
Logical Operations In Matlab.
Data Tables and Arrays.
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.
String Processing 1 MIS 3406 Department of MIS Fox School of Business
File Sharing and Processing Grouped Data
Data Manipulation (with SQL)
Final Thoughts.
Starter Activities GCSE Python.
Presentation transcript:

Beginning Data Manipulation HRP Topic 4 Oct 19 th 2011

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.

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.