Saving Data Steps with the Proc SQL Self-join Yan Wang Population Health Research Unit (PHRU) Dalhousie University.

Slides:



Advertisements
Similar presentations
Line Efficiency     Percentage Month Today’s Date
Advertisements

Unit Number Oct 2011 Nov 2011 Dec 2011 Jan 2012 Feb 2012 Mar 2012 Apr 2012 May 2012 Jun 2012 Jul 2012 Aug 2012 Sep (3/4 Unit) 7 8 Units.
HOW TO MAKE A CLIMATE GRAPH CLIMATE GRAPHING ASSIGNMENT PT.2.
SQL Chapter Two. Overview Basic Structure Verifying Statements Specifying Columns Specifying Rows.
PROC FORMAT – Not Just Another Pretty Face. PROC FORMAT, because of its name, is most often used to change the appearance of data for presentation. But.
Objective- To use tables and graphs to organize and represent data.
Non Leap YearLeap Year DateDay NumberMod 7Day NumberMod 7 13-Jan Feb Mar Apr May Jun Jul
Report to the SSC Jan 10, Report to the SSC-Jan 10/02Page 2 Key Dates Nov 13-14/01Preship Review Jan 4/02Final review before disassembly Jan 7Start.
SPOUSE LEADERSHIP DEVELOPMENT COURSE (SLDC) CLASS 68
Jan 2016 Solar Lunar Data.
IT Strategy Roadmap Template
Timeline Roadmap Template
How many ...?.
Analyzing patterns in the phenomena
Q1 Jan Feb Mar ENTER TEXT HERE Notes

Project timeline # 3 Step # 3 is about x, y and z # 2
Average Monthly Temperature and Rainfall
<Location> – <Project Name>, Sponsor: <name>
80-Hour SHARP Certification Course Schedule

IT STRATEGY ROADMAP TEMPLATE

GANTT CHARTS Example Text Text Here Text Here Text Here Text Here
Mammoth Caves National Park, Kentucky
2017 Jan Sun Mon Tue Wed Thu Fri Sat
Timeline PowerPoint Template
This Presentation Pack is brought to you by
MAINTENANCE TRAINING SCHEDULE
Gantt Chart Enter Year Here Activities Jan Feb Mar Apr May Jun Jul Aug
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
Free PPT Diagrams : ALLPPT.com
Demand Based on problem 4.15 from Glover, Klingman, and Phillips
SPOUSE LEADERSHIP DEVELOPMENT COURSE (SLDC) CLASS 69

Step 3 Step 2 Step 1 Put your text here Put your text here
MONTH CYCLE BEGINS CYCLE ENDS DUE TO FINANCE JUL /2/2015
Jan Sun Mon Tue Wed Thu Fri Sat
IT STRATEGY ROADMAP TEMPLATE
Bell Quiz How much did Maria earn babysitting in March?
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec ITEM 1 ITEM 2 ITEM 3
Electricity Cost and Use – FY 2016 and FY 2017

Safety Group Program Timeline
01 DRAW YOUR TIMELINE HERE JAN. MAR. JAN. MAR. FEB. APR. FEB. APR.
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Drafting Group: Final Meeting Drafting Group: 1st Meeting
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
Free PPT Diagrams : ALLPPT.com


Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Objective - To make a line graph.
Belem Climate Data Table
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Text for section 1 1 Text for section 2 2 Text for section 3 3
Project timeline # 3 Step # 3 is about x, y and z # 2
SPOUSE LEADERSHIP DEVELOPMENT COURSE (SLDC) CLASS 70
TIMELINE NAME OF PROJECT Today 2016 Jan Feb Mar Apr May Jun
Safety Group Program Timeline
2012 Safety Group Advantage Program Timeline
2012 Safety Group Advantage Program Timeline
2013 Safety Group Advantage Program Timeline
Q1 Q2 Q3 Q4 PRODUCT ROADMAP TITLE Roadmap Tagline MILESTONE MILESTONE
Presentation transcript:

Saving Data Steps with the Proc SQL Self-join Yan Wang Population Health Research Unit (PHRU) Dalhousie University

The Task ObsID indexdate exdate 11 28MAR APR APR JAN JUN JAN JAN JAN JAN FEB FEB FEB JUN1999. One data set with 2 dates: indexdate and exdate For each individual, subsetting records whose indexdate in the 120 days before or 90 days after exdate

proc sql; select a.*, (-90<= b.exdate-a.indexdate <=120) as diff from temp as a, temp as b where a.ID=b.ID; quit; Obs ID indexdate exdate diff MAR APR APR JAN MAR APR APR JAN MAR APR APR JAN Obs ID indexdate exdate MAR APR APR JAN2004. Obs ID indexdate exdate MAR APR APR JAN2004. Comparing

Obs ID indexdate exdate diff MAR JUN APR APR JUN JAN JAN JAN MAR JAN JAN APR APR FEB FEB JAN FEB MAR JUN APR APR JUN JAN JAN JAN JUN JAN JAN JAN JAN FEB FEB JAN JAN FEB FEB FEB JUN FEB JUN JUN JAN JAN JUN JAN JAN JAN JAN FEB FEB JAN JAN FEB FEB FEB JUN FEB JUN JAN JAN JAN JAN FEB FEB FEB JUN

proc sql; select distinct a.*, sum(-90 0 as index from temp as a, temp as b where a.ID=b.ID group by a.ID, a.indexdate; quit; Obs ID indexdate exdate index MAR APR APR JAN JUN JAN JAN JAN JAN FEB FEB FEB JUN Identifying

proc sql; create table tp as select distinct a.*, sum(-90 0 as index from temp as a, temp as b where a.ID=b.ID group by a.ID, a.indexdate having index = 1; quit; Subsetting Obs ID indexdate exdate index MAR APR APR JAN JAN JAN JAN FEB FEB FEB

Reference Subsetting SAS ® Data Set by Using PROC SQL Self-join with Compound Key Zizhong Fan, Westat, Rockville, MD