Download presentation
Presentation is loading. Please wait.
Published byGarret Newsum Modified over 9 years ago
1
5/1/2015 1 Quick and Dirty Excel® Workbooks Without DDE or ODS Andrea Zimmerman, Capital One, Richmond, VA
2
5/1/2015 2 Introduction “Efficiency is intelligent laziness” - David Dunham I have avoided learning DDE, Microsoft has warned they may cut it off at any time. I haven’t had the time to learn ODS and the XLtagset.
3
5/1/2015 3 PROC EXPORT The Data %let dir=C:\My Documents\2011 SAS paper\Excel\; %let file=template.xls; proc export data=sashelp.shoes outfile= “&dir.&file” dbms=excel replace; sheet=“shoe_data”; run; options noxsync noxwait; %sysexec &dir.&file; This will create the initial workbook and open it.
4
Not Very Pretty…
5
5/1/2015 5 Format and Build The Workbook Adjust column widths AutoFilter Freeze Panes Hide columns Color columns
6
5/1/2015 6 Format and Build The Workbook
7
5/1/2015 7 Format and Build The Workbook Build graphs Note in the function that it is referencing data cells. Right now, this shows the sales for the Addis Ababa data since it is in rows 2 through 9.
8
5/1/2015 8 Format and Build The Workbook Create a named range that adjusts to the amount of data. 1.Click Insert. 2.Highlight Name. 3.Select Define… 4.Name the range whatever you want (For example ShoeData). 5.Type this formula in the bottom text box (assumes shoe_data is the name of the tab): =OFFSET(shoe_data!$A$1,0,0,COUNTA(shoe_data!$A:$A),COUNTA(sh oe_data!$1:$1)) 6.Click OK.
9
5/1/2015 9 Format and Build The Workbook Create a pivot table using the named range. 1.Click Data. 2.Select PivotTable and PivotChart Wizard. 3.Click Next. 4.Replace the value of Range with the named range created earlier. 5.Click Next. 6.Click Finish. 7.Drag Region to be a Row Field. 8.Drag Product to be a Column Field. 9.Drag Sales to be a Data Item.
10
5/1/2015 10 Format and Build The Workbook
11
5/1/2015 11 Clear The Data and Save As… Once everything is set, delete the data from all tabs. Graphs will be empty, but the pivot tables will stay. Save as a name you’ll remember. I recommend including TEMPLATE so you remember the purpose.
12
5/1/2015 12 The X Command In your SAS code, before your PROC EXPORT, insert this code: options noxwait xsync; x copy “&dir.&file” “&dir.shoe_data_&today..xls”; Now you have a copy of the template with today’s date as part of the name. The template remains unchanged.
13
5/1/2015 13 Subset the Data Now we can subset the data data womens; set sashelp.shoes; if Product=:”Women’s”; run;
14
5/1/2015 14 Subset the Data Now we can Export this to our workbook: options noxwait xsync; x copy “&dir.&file” “&dir.shoe_data_&today..xls”; proc export data=womens outfile=“&dir.shoe_data_&today..xls” dbms=excel replace; sheet=”shoe_data”; run;
15
5/1/2015 15 New Workbook Note that this is just the Women’s products
16
5/1/2015 16 New Workbook You have to Refresh the Data in the pivot table when you open it.
17
5/1/2015 17 LIVE DEMO
18
5/1/2015 18 Conclusion Doesn’t have all the grace and finesse of DDE or ODS and it does have some limitations. It’s very fast to learn and master. For the majority of my reporting needs it is more than sufficient. A little VBA programming or conditional formatting can overcome any limitations that I’ve discovered. – If those are tools you already know, then this is a real time saver.
19
5/1/2015 19 Acknowledgement SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
21
How to Join Us Be an Attendee Invest in your future Expand your skills Get more value to yourself and your Company Follow us on Twitter @sesug1 #SESUG2014
22
How to Join Us Be an Attendee Invest in your future Expand your skills Get more value to yourself and your Company Follow us on Twitter @sesug1 #SESUG2014
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.