ACHOO - THE FLU, SAS & YOU Group...AGENDA ACHOO - THE FLU, SAS & YOU 1. Some like it cold -Ways to...
Transcript of ACHOO - THE FLU, SAS & YOU Group...AGENDA ACHOO - THE FLU, SAS & YOU 1. Some like it cold -Ways to...
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
ACHOO - THE FLU, SAS & YOU
CHARU SHANKAR, SAS INSTITUTE CANADA
Health User Group Toronto
20 November 2015
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
AGENDA ACHOO - THE FLU, SAS & YOU
1. Some like it cold -Ways to fight the flu
2. Data Collection
3. Data Analysis – a new tool in time for the holidays. DS2
4. Data Management – SAS Enterprise guide to prompt you.
5. Data Presentation – Get visual with a map
6. Handy Resources
7. Q & A
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
WAYS TO FIGHT THE
FLUWHAT DO I DO?
• Diet
• Oil Pulling
• Yoga inversions
• Medication - Ginger lozenges
• And THEN… Educate myself..Get SAS Help
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA COLLECTION ACHOO - THE FLU, SAS & YOU
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA ANALYSIS HOW ABOUT A NEW TOOL? DS2
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA ANALYSIS DS2 OVERVIEW
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
1. OBJECT BASED SYNTAX- USER DEFINED METHODS AND PACKAGES
PROC DS2;
data _null_;
method c2f(double Tc) returns double;
/* Celsius to Farenheit */
return (((Tc*9)/5)+32);
end;
method init();
dcl double Degc DegF;
do DegC=0 to 30 by 15;
DegF=c2f(DegC);
PUT DegC= DegF=;
end;
end;
enddata;
run;
quit;
Define method
Call method
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DS2 OVERVIEW 2. ANSI SQL DATA TYPE SUPPORT
EXTENDED DATA TYPES
BIGINT
BINARY(n)
CHAR(n)
DATE
DOUBLE
FLOAT(p)
INTEGER
NCHAR(n)
The syntax of the DS2
language intersects with the
SAS DATA step but also
includes additional data types,
ANSI SQL types, programming
structure elements, and user-
defined methods and packages
NVARCHAR(n)
REAL
SMALLINT
TIME(p)
TIMESTAMP(p)
TINYINT
VARBINARY(n)
VARCHAR(n)
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DS2 IS NOT A DATA STEP REPLACEMENT
DS2 Complements the DATA Step
DS2 has
•DATA and SET statements
•IF..THEN..ELSE, DO loops
•Expressions and Functions
•Future: Debugger
DS2 does not have
•INFILE and INPUT statement
•MERGE, UPDATE
•MODIFY / REPLACE
•POINT=
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
BASIC DS2 SYNTAXPROC DS2;
data _null_;
method init();
dcl varchar(20) foo;
foo = '**> Starting';
put foo;
end;
method run();
set ds2_sas.banks;
put _all_;
end;
method term();
dcl char(11) bar;
bar = '**> I quit!';
put bar;
end;
run; quit;
Initial processing
Execution loop
Final processing
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
3. EMBEDDED SQL IN DS2proc ds2;
data sales (overwrite=YES);
keep Customer_ID Total;
method run();
set {select c.Customer_ID
,Total_Retail_Price
from ds2_sas.order_fact f
full join
ds2_sas.customer_dim c
on f.Customer_ID=c.Customer_ID
order by 1};
by customer_id;
if first.customer_id then Total=0;
Total+total_retail_price;
if last.customer_id then output;
end; enddata;
run;quit;
Returns SQL
result set as input
stream
BY group
processing on
results
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DS2 WHY USE IT?
You will see the most benefit from DS2
1. When you need to use extended data types to maintain consistency with source
database
2. Where you have a complex process that could benefit from structured code. You
can make use of packages and methods to re-use common functions or operations.
3. Where you have computationally intense processes which can utilize parallel
processing.
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA ANALYSIS HOW ABOUT A NEW TOOL? DS2
• DS2 DEMO
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA MANAGEMENT PROMPTS IN SAS ENTERPRISE GUIDE
DO YOU LIKE TO BE PROMPTED?
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
DATA
PRESENTATION
GET VISUAL
WITH A MAP
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
HANDY RESOURCES LINKS & TRAINING
• SQL within SET Statement• Which Canadians get the Flu• Using Arrays in SAS Programming• I object: SAS Does Objects with DS2• Map code
Next dates for DS2 14-15 Dec 2015 • SAS Canada DS2 training
Copyr i g ht © 2012, SAS Ins t i tu t e Inc . A l l r ights reser ve d .
THANK YOU
LINKEDIN: CHARU SHANKAR
TWITTER: CHARUYOGACAN
SAS BLOG: BLOGS.SAS.COM/CONTENT/SASTRAINING/AUTHOR/CHARUSHANKAR