Presentation is loading. Please wait.

Presentation is loading. Please wait.

MASUG September 15, 2005. Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks 

Similar presentations


Presentation on theme: "MASUG September 15, 2005. Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks "— Presentation transcript:

1 MASUG September 15, 2005

2 Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks  Member Presentation  SAS inSchool

3 Announcements  and now a few words from Gordon Galey……..

4 Annotating Graphs Is Simpler Than You Think (With An email Excursion) Walt Smith FedEx Forecasting MASUG Sep 15, 2005

5 Graphs can be powerful ways to draw a picture of your data. Key information can be “drawn” on the graph to make the graph tell even more of the story. A simple example:

6 Do you see anything obvious?

7 There seems to be “events” in this time series – specifically a significant shift up between Dec03 and Jun04 – and another shift down about Jul05 Assuming the cause is known (in this case, a large account was won and lost), this information can be added.

8 This is more clear:

9 Why should I do this with SAS? I could just import my data into Excel and build a graph in just a few clicks (well, OK, more than a few clicks). What if you need to do it every month? Every week? Every day? For dozens – hundreds of graphs? – Still want to use Excel?

10 First the code to produce the basic graph proc gplot data=mydata.random_ts; plot sales * date / frame plot sales * date / frame haxis = axis1 vaxis = axis2 haxis = axis1 vaxis = axis2 cframe = cxeeeedd ; cframe = cxeeeedd ; format sales comma5.0; format sales comma5.0; format date monyy5.; format date monyy5.;run;

11 Then the options, symbol, and axis statements that will help dress it up. options orientation = landscape; goptions reset = all device = gif gunit = pct ftitle = swissb htitle = 5 ftext = swiss htext = 3 cback = cxbbc4cf ; symbol1 color=black interpol=join value=dot height=2 width=3 line=1; %let haxis = '01jun2002'd '01dec2002'd '01jun2003'd '01dec2003'd; %let haxis = &haxis '01jun2004'd '01dec2004'd '01jun2005'd '01dec2005'd; %let haxis = &haxis '01jun2006'd; axis1 label=none minor=none order=( &haxis ); axis2 label=none minor=none; title1 "Sales Region: Random";

12 Now for the annotations – SAS/Graph procedures accept an “annotate” dataset that contains the annotate information. Annotate information can be very simple or very complex according to your needs. An annotate dataset is simply a dataset that has certain “annotate” variables in it. The basic variables are the x,y coordinates to place the text (or object), the size, color, etc, and the function to perform (label, draw, etc)

13 The annotate data step code data anno; length color function style $8; length text $200; length x y 8; xsys = '2'; ysys = '2'; hsys = '5'; function = 'label'; set mydata.random_ts; if ( date = &event1 ) then do; x = date; y = sales + 150; size = 4; text = 'ABC Account'; style = 'swiss'; color = 'blue'; position = 'A'; output; y = sales + 75; size = 2; text = 'D'; style = 'marker'; position = 'B'; output; end; if ( date = &event2 ) then do; x = date; y = sales - 150; size = 4; text = 'Lost Account'; style = 'swiss'; color = 'red'; position = 'E'; output; y = sales - 75; size = 2; text = 'C'; style = 'marker'; position = 'E'; output; end; run;

14 Variables xsys, ysys, hsys specify the “coordinate system” for x, y values and sizes of things (like text)

15 Simplified code using 3 annotate macros data anno; %avars %xyhsys(2,2,5) set mydata.random_ts; if ( date = &event1 ) then do; %alabel(date, sales+150,'ABC Account',blue,,,4,swiss,A) %alabel(date, sales+75,'D',,,,2,marker,B) end; if ( date = &event2 ) then do; %alabel(date, sales-150,'Lost Account',red,,,4,swiss,E) %alabel(date, sales-75,'C',,,,2,marker,E) end; run;

16 The Annotate Dataset Has 4 Obs f p f p u o u o n s n s c c s s i c c s s i o t t t x y h d a s t o t t t x y h d a s t O l i y e s s s a l i i b o o l x y y y t e z o s r n e t x y s s s e s e n 1 blue label swiss ABC Account 16162 5761.74 2 2 5 APR04 5611.74 4 A 2 blue label marker D 16162 5686.74 2 2 5 APR04 5611.74 2 B 3 red label swiss Lost Account 16649 5634.84 2 2 5 AUG05 5784.84 4 E 4 red label marker C 16649 5709.84 2 2 5 AUG05 5784.84 2 E

17 Applying the annotate dataset is the easy part proc gplot data=mydata.random_ts; plot sales * date / frame haxis = axis1 vaxis = axis2 annotate = anno cframe = cxeeeedd ; format sales comma5.0; format date monyy5.; run;

18 Last, we want to send this graph in an email – using SAS %let mygraph = mygraph.gif; filename gsfile "&mygraph"; goptions gsfname=gsfile gaccess=sasgastd; proc gplot data=mydata.random_ts; … run; filename dummy email; data _null_; file dummy to = ("wjsmith1@fedex.com") subject = "Sales Region Report" attach = "&mygraph“ ; put 'Attached is the Sales Region Report.'; put 'If you have any questions feel free to call.'; run; SAS V9 Only

19

20 Member Presentation  Robert Hall, Baptist Memorial Health Care Corp.

21 SAS inSchool  John Boling, Director SAS inSchool

22

23


Download ppt "MASUG September 15, 2005. Agenda  Guest Introductions  John Boling – SAS inSchool  Tim Garton – Health Forecasts  Announcements  Tips & Tricks "

Similar presentations


Ads by Google