Dr. Arthur Tabachneck Director, Data Management

Slides:



Advertisements
Similar presentations
Competency Checklist Version 5. CREATING A CHECKLIST Authoring View.
Advertisements

Program Data Vector PDV Example 1. Data A; Input X1 X2 Y; Datalines; Z X1 X2 Y _N_ _ERROR_ PDV (green  drop) Data.
Combining Lags and Arrays [and a little macro] Lynn Lethbridge SHRUG OCT 28, 2011.
Worst, but still importable data I’ve ever seen Arthur Tabachneck Insurance Bureau of Canada.
Next Presentation: Presenter: Arthur Tabachneck Copy and Paste from Word or Excel to SAS Art holds a PhD from Michigan State University, has been a SAS.
Automagically Copying and Pasting Variable Names Arthur Tabachneck Roger DeAngelis Randy Herbison Insurance Bureau of Canada CompuCraft Inc Westat John.
Enough really good SAS ® tips to fill a book Arthur Tabachneck, President and CEO, myqna.org.
1 times table 2 times table 3 times table 4 times table 5 times table
Understanding SAS Data Step Processing Alan C. Elliott stattutorials.com.
TASS Meeting Copy and Paste from Excel to SAS September 19th, 2008 Copy and Paste from Excel to SAS Dr. Arthur Tabachneck, Director Data Management with.
Introduction to SAS Essentials Mastering SAS for Data Analytics Alan Elliott and Wayne Woodward SAS Essentials - Elliott & Woodward1.
Controlling Input and Output
TASS Meeting Setting GuessingRows when Importing Excel Files September 19th, 2008 Setting GuessingRows when importing Excel Files Dr. Arthur Tabachneck,
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
“LAG with a WHERE” and other DATA Step Stories Neil Howard A.
Tables Learning Support
TASS Meeting Using Multiple DOW Loops September 25th, 2009 Using Multiple DOW Loops Dr. Arthur Tabachneck Director, Data Management Idea stolen from a.
Do not put content on the brand signature area NOBS for Noobs David B. Horvath, CCP, MS PhilaSUG Winter 2015 Meeting NOBS for Noobs.
TASS Meeting using inputn to re-format data September 25 th, 2009 using inputn to re-format data Dr. Arthur Tabachneck Director, Data Management Note:
Temperature Controller for Contact us : (091) (011) , for more :
TASS Meeting Quickly Finding Project Code March 13th, 2009 A way to quickly find all of your project code Dr. Arthur Tabachneck Director, Data Management.
Monica Rosati is a certified trained Wedding Makeup Artist with more than 10 years of experience in Bridal hair and makeup in Toronto. Contact her and.
Best Assignment Writing Service Best Assignment Writing Service Best Assignment Writing Service is one of the reputed online writing service that provide.
Best Deals on Contact Lenses Without Prescription Contactlenses4us.com Contactlenses4us.com
Contact Us.
Chapter 11 Reading SAS Data
Function Tables.
in problem.
Software Testing Services
Software Testing Services. Table Of Contents Contents 1.Company Profile 2.Software Testing Services 3. Benefits of Software Testing Services.
How To Add A Xerox Printer To Google Chrome
ASSIGNMENT NO.-2.
Frio River Cabins - Frio Vacation Homes - Frio Country Resort
Times Tables.
Best Collection of Athletic Tees - First Round Talent
What is your FICO IQ Quiz? Link to article attached.
Generic Careprost eye drop INCREASE YOUR EYELASHES WITH BEST EYE CARE PRODUCT.
Website: Contact No: ID:

best seo company canada
BACK SOLUTION:
Compilation VS Interpretation
hNews Martin Moore, Director, Media Standards Trust
Supplement: Using the DBDesign System
October 25, 2013 Stephanie Alexander
مديريت موثر جلسات Running a Meeting that Works
Annotated Bibliography
DO NOW Homework: Lesson 5-2 Practice (pg. 75)
Warm Up 10/15/14 How much of a 25% solution would you need to mix with 20 ounces of a 46% solution to obtain a 32% solution? If Jack can fetch a pail.
Professional Logo Designer in Mumbai
Identifying a source when you’re not sure what it is
POWER CHALLENGES Several Ways To Solve 7 CHALLENGES.
Primary and Secondary Source Activity
Town Hall Meeting Sponsored by the Bayou Vista Volunteer Fire Department & Board of Directors Tuesday, March 18, :30pm-8:00pm.
(team representative name here)
a useful SAS 9.2 feature I wasn’t aware of *
3 times tables.
6 times tables.
X Y Relation (a set of ordered pairs) x y x y ( , ) x y Mapping
Basic 9 Mr. Husch.
suits/salwar-kameez Visi t: ID: Contact No: Follo w Us.
Firebase Vs. MongoDB: Choose the Best Database of 2019
I have… I have… Who has 3:40? Who has 12:20? I have… I have…
Types of Errors And Error Analysis.
Introduction to SAS Essentials Mastering SAS for Data Analytics
Meet Us
Contact Us
Doctors List
Presentation transcript:

Dr. Arthur Tabachneck Director, Data Management Look Both Ways Dr. Arthur Tabachneck Director, Data Management Note: program stolen from a SASOPEDIA article by Howard Schreier http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back

suppose you had the following data: data have; input ID $ Measure; cards; A 11 A 12 A 13 A 14 B 21 B 22 B 23 ;

and you needed to have the following table: data need; input ID $ Measure Next_Measure Last_Measure; cards; A 11 12 . A 12 13 11 A 13 14 12 A 14 . 13 B 21 22 . B 22 23 21 B 23 . 22 ;

that is, with the following assignments made: ID Measure Next_Measure Last_Measure -- ------------ --------------------- -------------------- A 11 12 . A 12 13 11 A 13 14 12 A 14 . 13 B 21 22 . B 22 23 21 B 23 . 22

that is, with the following assignments made: ID Measure Next_Measure Last_Measure -- ------------ --------------------- -------------------- A 11 12 . A 12 13 11 A 13 14 12 A 14 13 B 21 22 . B 22 23 21 B 23 22

that is, with the following assignments made: ID Measure Next_Measure Last_Measure -- ------------ --------------------- -------------------- A 11 12 A 12 13 11 A 13 14 12 A 14 . 13 B 21 22 B 22 23 21 B 23 . 22

a data step solution data need; set have; by ID; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #1: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 11 1 0 . . 0 1 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #1: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 11 1 0 12 . 0 1 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #1: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 11 1 0 12 . 0 1 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #2: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 12 0 0 12 . 0 2 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #2: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 12 0 0 13 . 0 2 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #2: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 12 0 0 13 11 0 2 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #3: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 13 0 0 13 11 0 3 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #3: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 13 0 0 14 11 0 3 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #3: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 13 0 0 14 12 0 3 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #4: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 14 0 1 14 12 0 4 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #4: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 14 0 1 21 12 0 4 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #4: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ A 14 0 1 . 13 0 4 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #5: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 21 1 0 . 13 0 5 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #5: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 21 1 0 22 . 0 5 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #5: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 21 1 0 22 . 0 5 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #6: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 22 0 0 22 . 0 6 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #6: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 22 0 0 23 21 0 6 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #6: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 22 0 0 23 21 0 6 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #7: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 23 0 1 23 21 0 7 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #7: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 23 0 1 11 22 0 7 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

Why it works: Under the hood-Iteration #7: ID Measure FIRST.ID LAST.ID Next_Measure Last_Measure _ERROR_ _N_ B 23 0 1 . 22 0 7 PDV ID Measure -- ------------ A 11 A 12 A 13 A 14 B 21 B 22 B 23 data need; set have; by ID; PutLog _all_ ; set have ( firstobs = 2 keep = Measure rename = (Measure = Next_Measure) ) have ( obs = 1 drop = _all_); Last_Measure = ifn( first.ID, (.), lag(Measure) ); Next_Measure = ifn( last.ID, (.), Next_Measure ); run;

ending up with the following table ID Measure Next_Measure Last_Measure -- ------------ --------------------- -------------------- A 11 12 . A 12 13 11 A 13 14 12 A 14 . 13 B 21 22 . B 22 23 21 B 23 . 22

Questions? Your comments and questions are valued and encouraged. Contact the author: Dr. Arthur Tabachneck Director, Data Management Insurance Bureau of Canada Toronto, Ontario L3T 5K9 Email: atabachneck@ibc.ca