File Sharing and Processing Grouped Data

Slides:



Advertisements
Similar presentations
Final Thoughts HRP 223 – 2013 December 4 th, 2013 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation.
Advertisements

Statistics in Science  Introducing SAS ® software Acknowlegements to David Williams Caroline Brophy.
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:
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.
Permanent Formats and Working Across Platforms. 32bit vs. 64 bit SAS The different versions of SAS optimize datasets and formats to work as fast as possible.
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.
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.
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:
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.
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.
Lesson 6 - Topics Reading SAS datasets Subsetting SAS datasets Merging SAS datasets.
SAS Basics. Windows Program Editor Write/edit all your statements here. Log Watch this for any errors in program as it runs. Output Will automatically.
Chapter 17: Formatting Data 1 STAT 541 ©Spring 2012 Imelda Go, John Grego, Jennifer Lasecki and the University of South Carolina.
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.
SAS Basics. Windows Program Editor Write/edit all your statement here.
1 Lab 1 HRP223 – 2011 Oct 10, 2011 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.
Computing with SAS Software A SAS program consists of SAS statements. 1. The DATA step consists of SAS statements that define your data and create a SAS.
FORMAT statements can be used to change the look of your output –if FORMAT is in the DATA step, then the formats are permanent and stored with the dataset.
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.
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.
Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected by copyright law and international.
SAS ® 101 Based on Learning SAS by Example: A Programmer’s Guide Chapters 3 & 4 By Tasha Chapman, Oregon Health Authority.
Creative Create Lists Elizabeth B. Thomsen Member Services Manager
Summary HRP223 – 2009 October 28, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
Chapter 6: Modifying and Combining Data Sets
SAS Programming Introduction to SAS.
Working with Data in Windows
FAST Administration Training
SAS Output Delivery System
Instructor: Raul Cruz-Cano
Tamara Arenovich Tony Panzarella
Combining (with SQL) HRP223 – 2013 October 30, 2013
Working With Dates: Dates Come in Many Ways
Introduction to DATA Step Programming: SAS Basics II
Working With Dates: Dates Come in Many Ways
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.
Spreadsheets, Modelling & Databases
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
Data Manipulation (with SQL)
Working with Data in Windows and Descriptive Statistics
Processing Grouped Data
Using the FAST Page Builder
Presentation transcript:

File Sharing and Processing Grouped Data HRP223 – 2011 November 14th, 2011 Copyright © 1999-2012 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.

Formats Saved in Libraries * x "mkdir C:\Projects\hrp223\cportExample"; libname cportex "c:\projects\hrp223\cportexample"; proc format library = cportEx; value isMale 0 = "Female" 1 = "Male" . = "Missing" other = "** bad **" ; run; Save the format here instead of in work. SAS is pushing this idea.

Your library name goes here. Where to Find Formats SAS and EG look for formats in the work library. You can tell it to look in other libraries with a line like this: options fmtsearch = (cportEx work); Your library name goes here.

Sharing Files If everyone on your team uses the same version of SAS you can send datasets and catalogs via encrypted email. Send both the files in the library and teach the recipient about options fmtsearch . data cportEx.stuff; format sex isMale.; input ID age sex; datalines; 1 83 1 2 82 0 ; run;

proc cport If you need to share datasets and formats across platforms (including 32 vs 64 bit Windows SAS), store the library in cport file and send that (via encrypted email). proc cport library = cportEx file="C:\Projects\hrp223\cportExample\example.cport" memtype = all; run; Send this one.

proc cimport Use proc cimport on the other machine: libname cportEx "C:\Projects\hrp223\cportExample"; options fmtsearch = (cportEx work); proc cimport library = cportEx file = "C:\Projects\hrp223\cportExample\example.cport" ; run;

No Formats… If somebody forgets to send you the formats you can include this line and the data will display unformatted without errors: options nofmterr;

32bit vs. 64 bit SAS The different versions of SAS optimize datasets and formats to work as fast as possible. You can open a 32 bit SAS dataset with a 64 bit version of SAS but it is slower than necessary. Formats saved in permanent libraries (as catalogs) may have problems opening on different platforms/operating systems.

Analysis Procedures by… You may need to work on groups of subjects (or other things). That is, you want to organize your data by some grouping variable. Most analysis procedures will let you do this easily.

Means by Group does not need to be sorted (class statement) if the data is already sorted (by statement)

Summary Statistics

Complicated Processing by Group Say you want to get the first or last element in a sorted list. Sort the data if needed. Include a by THING statement in a data step. Use the automatically created first.THINGY and/or last.THING variables Automatically make first.act and last.act variables. Set first.act = 1 on first record of an act group of records and last.act = 1 on last record of the groups. 1 = true in a logic check

Complex Running Totals Say you want to get the average radiation from the first two chest x-rays that a patient receives and the visits are not in order. Sort the data by patient and date. In a data step: Set a visit counter to 0 on first visit. Add one for every subsequent visit. Keep the records where visit < 3.

Many Ways to Sort Choose the Filter and Sort, the Query Builder or the Data > Sort Data… context sensitive menus.

The PDV does not remember the old values. Once the data is subsetted and ordered, use a data step and process by the subject ID. The PDV does not remember the old values. data firstTwo; set sorted; by dude; if first.dude then visit = 1; else visit = visit + 1; run;