sas 9.1 ms office integration chevell parker, sas...

34
1 SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute INTRODUCTION This document discusses the various developments of integrating SAS Output into Excel and other applications. These techniques involve a variety of methods using ODS and Base SAS. There are various ways of creating output which can be exported to Excel, but the best method depends on your versions of both SAS, Excel and your needs. Most of the methods that we will discuss involve ODS destinations which are part of the ODS Markup family. From this document, you will see the power of the ODS Markup destinations as well as other methods when exporting to Excel. We have the ability to fully customize Excel worksheets and workbooks generating presentational quality output directly from SAS. Whether you are freezing headers or adding filters, we have the ability to make these type modification from SAS using ODS. How you go about doing this as mentioned earlier will depend on several factors which we will explore. Listed below are some of the tagsets that are commonly used to generate output which is exported to Excel and are part of the ODS Markup family. TAGSETS.EXCELXP the ExcelXP destination we can be used to modify everything from frozen headers to adding formulas. As of the current release of SAS 9.2, there are some things that cannot be modified within the worksheet or workbook using the ExcelXP tagset. Some of these items are restrictions from the XML Spreadsheet format such as VB macros, outlines, and graphics. Other things can be driven with options on the ExcelXP tagset which we will explore. This destination generates multiple worksheets per workbook as a default and has options to fully automate the customization of a worksheet and workbook. The ExcelXP tagset requires Excel 2002 or greater as well as SAS 9.1. or greater. Hopefully, you will find that your most common tasks in Excel are added using option to the tagset. MSOFFICE2K The MSOffice2K destination became available with SAS 9.0. This destination generates HTML by default file format. The output can be consumed by Excel 2000 in addition to the later versions of Excel. It also allows you to add images and graphics unlike the ExcelXP destination. There are some differences in the styles and the general usage of the MSOffice2k and the ExcelXP destination which will be discussed later in this document. The HTML which is generated from this destination is geared to work specifically with the Office applications that can read HTML. CSV The CSV destination does not have presentational capabilities. One of the main benefits of this destination is that it creates a very small file. One of the other benefits is that this format is easy to read with other applications. HTML Generates output using HTML 4.01 in both SAS 9.1 and SAS 9.2. The output created using this destination is more suitable for the browser rather than Excel. This is because of the tagging such as the table tag which is used for the titles and footnotes which place them in a single cell. Also, because of how the embedded styles are referenced using the multiple classes, the style information does not come across in Excel. This was the destination to use prior to SAS 9, however, this has no benefit over the other previously mentioned destinations. HTML3 The HTML3 destination generates output using HTML 3.2 tagging which is the same output that was generated with SAS 8.2. It uses tagging for all of the formatting and does not embed CSS like the MSOffice2K destination. The file size is larger with this destination compared to the MSOffce2K, ExcelXP and the HTML destinations. The formatting or style information is not separated from the data. TABLEEDITOR- A downloadable tagset which allows you to generate Excel output including native Excel, Pivot Tables, and update existing worksheets.

Upload: others

Post on 23-Sep-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

1

SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute INTRODUCTION This document discusses the various developments of integrating SAS Output into Excel and other applications. These techniques involve a variety of methods using ODS and Base SAS. There are various ways of creating output which can be exported to Excel, but the best method depends on your versions of both SAS, Excel and your needs. Most of the methods that we will discuss involve ODS destinations which are part of the ODS Markup family. From this document, you will see the power of the ODS Markup destinations as well as other methods when exporting to Excel. We have the ability to fully customize Excel worksheets and workbooks generating presentational quality output directly from SAS. Whether you are freezing headers or adding filters, we have the ability to make these type modification from SAS using ODS. How you go about doing this as mentioned earlier will depend on several factors which we will explore. Listed below are some of the tagsets that are commonly used to generate output which is exported to Excel and are part of the ODS Markup family. TAGSETS.EXCELXP the ExcelXP destination we can be used to modify everything from frozen headers to adding formulas. As of the current release of SAS 9.2, there are some things that cannot be modified within the worksheet or workbook using the ExcelXP tagset. Some of these items are restrictions from the XML Spreadsheet format such as VB macros, outlines, and graphics. Other things can be driven with options on the ExcelXP tagset which we will explore. This destination generates multiple worksheets per workbook as a default and has options to fully automate the customization of a worksheet and workbook. The ExcelXP tagset requires Excel 2002 or greater as well as SAS 9.1. or greater. Hopefully, you will find that your most common tasks in Excel are added using option to the tagset. MSOFFICE2K The MSOffice2K destination became available with SAS 9.0. This destination generates HTML by default file format. The output can be consumed by Excel 2000 in addition to the later versions of Excel. It also allows you to add images and graphics unlike the ExcelXP destination. There are some differences in the styles and the general usage of the MSOffice2k and the ExcelXP destination which will be discussed later in this document. The HTML which is generated from this destination is geared to work specifically with the Office applications that can read HTML. CSV The CSV destination does not have presentational capabilities. One of the main benefits of this destination is that it creates a very small file. One of the other benefits is that this format is easy to read with other applications. HTML Generates output using HTML 4.01 in both SAS 9.1 and SAS 9.2. The output created using this destination is more suitable for the browser rather than Excel. This is because of the tagging such as the table tag which is used for the titles and footnotes which place them in a single cell. Also, because of how the embedded styles are referenced using the multiple classes, the style information does not come across in Excel. This was the destination to use prior to SAS 9, however, this has no benefit over the other previously mentioned destinations. HTML3 The HTML3 destination generates output using HTML 3.2 tagging which is the same output that was generated with SAS 8.2. It uses tagging for all of the formatting and does not embed CSS like the MSOffice2K destination. The file size is larger with this destination compared to the MSOffce2K, ExcelXP and the HTML destinations. The formatting or style information is not separated from the data. TABLEEDITOR- A downloadable tagset which allows you to generate Excel output including native Excel, Pivot Tables, and update existing worksheets.

Page 2: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

2

ODS Destination Required

SAS File Format

Required Excel

ExcelXP SAS 9.1 2002+

MSOffice2K SAS 9.0 2000+ HTML/HTML3 SAS 7.0 97+

CSV SAS 8.2 97+

UPGRADING TO EXCEL 2007 Excel 2007 comes with a lot of changes and enhancements which everyone is excited about. The row limit of 65,565 has been increased to 1 million. The 265 column limit has been increase from 256 to 16,000. Prior to Excel 2007, the colors were limited to 56 colors, however, Excel can now display over 4.3 billion colors. In this release, Excel has moved the default format from the binary proprietary XLS format to a compressed XML format which is an open standard. This means that you have the ability to import and analyze more data with Excel in this release. There are also some differences that you need to be aware of as well. When you use the .XLS extension on a file as you have in prior releases to generate output with ODS, this will generate an extra dialog box which did not exist in prior versions of Excel. This dialog is a new security feature which informs you that the file is not a native Excel file. If you are using the ExcelXP destination, then you can use the .XML extension to get around this dialog as this will open the file in Excel. However, because the MSOffice2k destination generates HTML which does not match the file extension of the native output of a .XLS file, a dialog box is generated with a warning. With so many things that could have been enhanced, this was not one that I would have picked. There also windows registry settings that can be modified to prevent this dialog from appearing which is what is needed for the MSOffice2K destination. Always back up first before modifying windows registry. If you have to roll this out to quite a few users, perhaps adding this in a script would be the way to go.

1. Open your Registry (Start -> Run -> regedit.exe) 2. Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY 3. Right click in the right window and choose New -> DWORD 4. Type “ExtensionHardening” as the name (without the quotes) 5. Verify that the data has the value “0” SELECTING AN EXPORT METHOD The method that you select between ODS, DDE, PROC EXPORT, the Add-in to Microsoft Office or some other method really depends on your needs, what versions of SAS and Excel you have and the products that you license. There are times when you will want or need to use all 3. Having the Add-in is the Bentley of the group if we had to associate the products with cars, as this allows you to integrate SAS output seamlessly within Excel. ODS is great for generating presentational quality output. You can modify fonts, colors, add links and so on. Also to get basic output is extremely easy by just adding an ODS wrapper around the output. Unlike DDE and PROC EXPORT, ODS can generate output across all platforms. The EXPORT procedure is very easy to use. As mentioned, it can create native Excel files and can read, write and update Excel files as can DDE. It also has a very convenient Excel Libname engine which can be used to read, write and update Excel files. DDE is very powerful and can control the majority of the application using macro commands. These commands can be found by downloading the macrofun.exe file from the Microsoft site.

Page 3: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

3

Benefit ExcelXP MSOffice2K CSV PROC

EXPORT DDE

Multiple Worksheets √ √ √ Graphics √ √ Styles √ √ √ Native Excel files √ √ Use Options √ √ Update worksheets √ √ Read /Write Excel files √ √ Create output on all OS

√ √ √ √ √

ODS MARKUP AND TAGSETS A tagset is basically a collection of events. These events contain the tags which make up the various sections of the output generated by the destination. The events are triggered in a certain order. What’s great about tagsets is that you have the ability to completely modify the events such as deleting, reordering and changing the tagging. Once a tagset is created, it can be used as an ODS destination by specifying the tagset name on the ODS statement. The ExcelXP, HTML (HTML4), CSV, MSOFFICE2k destinations all have underlying tagsets. The revolutionary implementation of tagsets means that fixes can be rolled out quicker than in the past. There is active development on tagsets such as ExcelXP and downloads can be retrieved from the Base R&D web site. To see a list of the tagsets shipped with SAS, use the below PROC TEMPLATE code. All of the tagsets shipped with SAS are stored in the SASHELP location by default. The below code will list all tagsets on the default path. proc template; list tagsets; run;

TAGSET INSTALLATION AND STORAGE If you have decided that there are features or fixes that you want that are included in an updated ExcelXP tagset which is posted on the BASE R&D web site, you will have to make a decision of where you want to store the compiled ExcelXP tagset. If you want to store the tagset only for your use, you can execute the tagset download code by bringing the code into the program editor and running it, or simply %INCLUDE the code into the program. Executing the code will compile and store the tagset in the default location which is the SASUSER. TEMPLAT. The SASUSER.TEMPLAT item store is the location that we read and write to first based on the default ODS path. The ODS PATH statement can be modified to change the location of where we read and write the tagset. We would run into trouble if we could not write to SASUSER, because SASHELP is read only. For instance, if you have the –RSASUSER option specified, there is no place to compile this tagset since SASUSER is marked read only. You can modify the ODD PATH to point to the library of your choice such as the work location or some other permanent location which will give you write access to the template store. The SAS Note below goes into greater detail. Also, the example below modifies the ODS PATH statement to add the WORK location to the beginning of the path using the PREPEND sub-option of the ODS PATH statement. http://support.sas.com/kb/32/394.html Default ODS Path sasuser.templat(update) sashelp.tmplmst(read);

Ex1. ods path(prepend) work.templat(update); %include "excltags.tpl"; To store the updated ExcelXP tagset or other tagsets and templates where all users can access them, the location needs to be a place where all users have access. If the tagsets are compiled and saved to a location other than the default path, the ODS PATH statement would need to be used to add this location to the default path where ODS will search for it. . This is similar to the FMTSEARCH option which adds formats libraries to the default search path. This ODS PATH statement can be added to the code or added to an autoexec file. The PREPEND sub-option of the ODS PATH statement adds this location to the beginning of the search path negating the need to redefine the entire path.

Page 4: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

4

The user would then display the second part of this in an autoexec file or in the code to use this tagset. Below is an example including the ExcelXP tagset into the current program. Libname xxx 'l:\templib'; ods path(prepend) xxx.templat(update); %INCLUDE "EXCLTAGS.TPL; USER: Libname xxx 'l:\templib'; ods path(prepend) xxx.templat(read); UPDATING THE SASHELP LIBRARY Modifying the SASHELP location allows you to replace a member in the item store with a new copy. To update the SASHELP library, only the SASHELP.TMPLMST item store will need to be added to the ODS PATH statement with an access mode of update. Be sure to backup the SASHELP library first before updating this location. If you are using SAS in a client server environment and you have users currently using SAS , you will get the error that the template store is not available and does not allow you update access. In this event, you may want to update the SASHELP location during a scheduled outage. Ex. Ods path sashelp.tmplmst(update); UPDATING TAGSETS ON MVS Some characters that are present in the tagset such as the left and right brackets and the NOT operator ( “[ ]^") may not be represented in the codepage which is being used. If this is the case, errors are generated attempting to compile the ExcelXP or other tagsets that have this character. Typically, we can use the CHARCODE option along with substitute characters to get around this problem. However, this does not work well in this case because the tagset uses an elaborate set of pattern matching which includes some of the same characters. The easiest method in this case is to download the binary copy of the item store which you can by contacting Technical Support. To see more information on using ODS on the mainframe, follow the below link. http://support.sas.com/rnd/base/topics/templateFAQ/MVSODS3.pdf#pagemode=bookmarks EXCELXP TAGSET This section will discuss the usage of the ExcelXP tagset. Discussed are common errors and trouble shooting techniques to diagnose those errors. Also handled are questions regarding file size , how to make the most of your styles and the many options of the ExcelXP tagset. The first topic that I would like to discuss would be the different versions of the ExcelXP tagsets and what to expect. The ExcelXP tagset became available with 9.1 vanilla with the note in the log stating that this was the experimental version of the tagset. This version of the tagset did not contain the ability to pass options. Below are some of the major releases of the ExcelXP tagset. See the link below for the location of the latest tagset download. V1.28 This is the version shipped with 9.1.3 SP4. This version added many of the options but did not include such

options needed to pass number formats to Excel. If some options do not work that are listed in the below, it is time to update the tagset.

V1.70 This version of the tagset was shipped with SAS 9.2TS0M0. This tagsets is fully compatible with SAS 9.1.3SP4. This introduced the new enhancements that made the use of styles more efficient

V.1.86 There were several versions of the tagset between v1.28 and v1.86. Version 1.86 was a documented tagset downloadable from our website which was an update for SAS 9.1.3 SP4 and 9.2TS1M0 the vanilla release of SAS 9.2. This tagset had quite a long life.

V.1.94 This is the version of the tagset that is shipped with SAS 9.2TS2M0 phase 2. This is fully compatible with SAS 9.1.3SP4.

V1.116 This is the latest version of the tagset which added several new features such as the ability to handle stacked tables and additional wrap text ability. Also for graphics procedures, links are added to the worksheet which will allow you to select your graphs to view.

TROUBLE SHOOTING When problems occur using the ExcelXP tagset, you can test your code with the latest version of the ExcelXP tagset which is downloadable from the BASE SAS R&D web site. If you have not downloaded a copy from the web site, you have the tagset that was shipped with the current version of SAS that you have installed.. Depending on the SAS release that you have installed, this version of the ExcelXP tagset might be rather old. If you have SAS 9.1.3 SP4,

Page 5: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

5

the tagsets shipped would be rather old as far as fixes and functionality and you would want to download a more recent copy. This would not likely be if you have SAS 9.2. If you are getting errors when opening the Excel file, or options are ignored, then test your output against the latest version of the ExcelXP tagset. For example, SAS 9.1.3 SP4 ships with the version 1.28 of the ExcelXP tagset. Since this version, there have been quite a few updates added which currently displays 1.116 on the web site. You can test using the most updated tagset without actually having to install the ExcelXP tagset permanently. Using the URL access method, you can test with the latest tagset from the BASE R&D Web site before actually downloading it physically. The path where it’s stored can be modified for testing by adding the ODS PATH statement. The below example imports the tagset from the URL here at SAS where the tagset is stored into the work location which will be available for the duration of the session. filename temp url "http://support.sas.com/rnd/base/topics/odsmarkup/excltags.tpl"; ods path(prepend) work.templat(update); options source2; %include temp;

ERRORS OPENING FILES If you have XML parsing errors, it’s because Excel's XML parser found errors while opening this file. You will want to check the dialog message which is generated. This is an error log created which points us directly to the dump of the errors that the parser saw. Take a look at the below example file generated. I purposely modified the XML file so that the file is not well formed and would generate an error. The error describes the general location where the problem occurs in the XML file. First, we need to locate this temporary file which is specified with the dialog message when attempting to open this Excel file. When searching for this file on the windows platform, you might have problems locating this file. The reason is because this is one of Microsoft's hidden folders that you can never unhide. To view this file, from the RUN command of the START menu, type the following in the box and then click up one level. This should take you to all of the hidden files. You might find some files that need deleting also in this process. "C:\Documents and Settings\username\Local Settings\Temporary Internet Files\Content.MSO"

Figure 1. XML Error Dialog XML ERROR in Table REASON: Bad Value FILE: C:\Documents and Settings\sasctp\Local Settings\Temporary Internet Files\OLK37\t7.xls GROUP: Row TAG: Cell ATTRIB: StyleID VALUE: parskip XML ERROR in Table REASON: Bad Value FILE: C:\Documents and Settings\sasctp\Local Settings\Temporary Internet Files\OLK37\t7.xls GROUP: Row TAG: Cell ATTRIB: StyleID VALUE: parskip FILE SIZE Prior to version 1.70 of the ExcelXP tagset, the preferable method of adding styles was to use PROC TEMPLATE rather than using the STYLE= option with overrides that some of the procedures support. This was due to the way that styles were managed by the tagset. Adding style overrides using the STYLE= option on the procedure level

Page 6: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

6

would generate larger than expected files. Adding style overrides to a variable such as the foreground color would generate a unique Style ID for each value in the style definition section prior to version 1.70 of the tagset. Depending on the number of observations, this file can get really large. The XML file format can get really large even without this issue just because of the nature of this format. If you compare the file size of a file generated with the ExcelXP tagset with a file saved from Excel in its native file format, you will see quite a difference in the file size. If the file size is an issue in the current release, some options to consider are the following:

1. Use the SAVE-AS from Excel and save the file in the native Excel format. 2. Use the CSV destination which generates a small file because there is no tagging. 3. Use DDE to programmatically save the file in the native Excel format if on windows

/* Sample Output */

Ods tagsets.excelxp file=”c:\temp\temp.xls”; proc print data=sashelp.class; run; Ods tagsets.excelxp close; /* DDE Saves file as Native Excel file */ options noxwait noxsync; filename cmds dde 'excel|system'; data _null_; file cmds; X=SLEEP(10); put "[open(""C:\temp\temp.xls"")]"; put '[ERROR("FALSE")]'; put "[SAVE.AS(""C:\temp\temp.xls"",1)]"; X=SLEEP(2); put '[close("false")]'; run;

4. Use the TableEditor tagset to open the file and save it back to the file format of your choice. Unlike the method using DDE, the Excel file does not have to be open. The UPDATE_TARGET= option will be specified along with the EXCEL_SAVE_FILE= option.

Ods tagsets.tableeditor file="%sysfunc(getoption(work))\temp.html" options(update_target="c:\\temp\\test.xls" excel_save_file="c:\\temp\\test.xls" file_format="xls" auto_excel="yes" open_excel="no"); data _null_; file print; put "Save as Excel"; run;

Ods tagsets.tableeditor close;

STYLES Styles allow you to modify the presentation of the output generated with ODS. This could be anything from modifying the colors, fonts, borders, hyperlinks and more. Let’s take a look at a few basic examples of style modifications such as adding and removing gridlines and modifying colors and fonts. This section will also elaborate on colors which can be used with Excel 2003. There is also a link to some downloadable styles specifically generated for use with the ExcelXP tagset. This separates using ODS from DDE and PROC EXPORT when generating files for Excel. EXCEL COLORS Unlike the browser where you have access to many colors, Excel 2003 and below limits you to 56 colors at a time. Each workbook has a color palette that has 56 colors. For that workbook you have only access to these colors of the palette. You can modify the palette to change the colors that can be used but still limited to the 56 colors of this

Page 7: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

7

palette. The same colors that you specify and looks great in the browser may not look the same in Excel depending on the colors. This is not the case for Excel 2007 which supports 4.3 billion colors. Below are some of the 56 colors that are on the default palette. When creating output for your users that are using Excel versions prior to 2007, you will want to specify colors from the 56 color palette to be safe.

Figure 2. Excel 56 color palette CREATING STRIPED REPORT Alternate row colors which are referred to as striped or banner reports can be added by using the ExelXP tagset along with PROC REPORT and the CALL DEFINE statement. Within the compute block a counter can be added and used within the MOD function. The CALL DEFINE statement with the _ROW_ value and the desired style can be used to add the striped look. This enhances the readability of the report. We can also do this via formulas, see the section regarding formulas. ods tagsets.excelxp file="temp.xls"; proc report data=sashelp.class nowd style(report)={background=black}; columns name age sex height weight; compute weight; count+1;

if mod(count,2) then call row_,"style","style={backgroundcolor=cyan}"); endcomp; run; ods tagsets.excelxp close;

Figure 3. Alternate row colors

Page 8: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

8

TABLE GRIDLINES Output generated with the ExcelXP destination uses the default style which has gridlines by default. This default can be modified using PROC TEMPLATE or with procedures that support the STYLE= override option. The BORDERWIDTH= and the CELLSPACING= option within the Table style element can be used to remove gridlines between the rows and columns. The example below demonstrates how this is done. Proc template; define style styles.nogrid; Parent=styles.default; style table from table / borderwidth=0 cellspacing=0; end; run; ods tagsets.excelxp file="temp.xls" style=styles.nogrid; proc print data=sashelp.class; run; ods tagsets.excelxp close;

Figure 4. Output before styles added Figure 5. Output after styles added WORKSHEET GRIDLINES The gridlines that are displayed with native Excel output can be added to the output of the ExcelXP destination by using the BACKGROUND= attribute with the argument “transparent” within the style element Body. This looks like the native Excel or CSV output . The below example uses PROC TEMPLATE and parents from the Minimal style. The example below removes both the worksheet and the table gridlines. Proc template; define style styles.test; parent=styles.minimal; style body from body / background=transparent; style table from table / borderwidth=0 cellspacing=0; end; run; ods tagsets.excelxp file="temp.xls" style=styles.test; proc print data=sashelp.class;

Page 9: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

9

run; ods tagsets.excelxp close;

Figure 6. Output SAS SUPPLIED STYLES Both the MSOffice2K and the ExcelXP use the DEFAULT style for its formatting. This looks good in the browser and in Excel. If this style is not suitable for your needs, there are alternatives. The default style could be modified or we could choose from some of the other styles that are shipped with SAS. Displayed below is the list of SAS styles. Because of colors or fonts, some of the styles are not suitable for the Excel output. I have Highlighted are a few styles that looks well in Excel.

Figure 7. Output CUSTOM STYLES You can also find a gallery of many downloadable styles which use colors from the 56 color palette. You can also see how these styles look in Excel along with the code which generated the styles. The styles were generated using version 1.86 of the ExcelXP tagset. The code can be downloaded and run to generate the displayed style. Below is a short display of styles that can be downloaded from the custom styles below. Some of the styles mimic styles supplied by Excel.

Page 10: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

Figure 8 CELL FThe resultsExcel handGeneral foformat. Be E

leTeva

Chth

Applying athe ExcelXformat whtemplate foWhen 0 is the minimastrips all co

8. Custom style

ORMATTINs might not appdles numbers. rmat does a beelow are some

Excel Output eading zeroes aext can be dispalues greater thharacter strings

he comma SAS

n Excel numbeXP destination uich is a literal nor display. If thspecified as th

al style or if youommas. Below

e for Excel

NG pear exactly asExcel uses the

est guess basee of the issues t

are dropped froplayed as a dathan 11 end up s may incorrec

S format is strip

er format guarausing the paramname or a custohe # digit selecte digit selector

u use the CSV w is a table of E

you expect whe General formed on the valuethat you can ex

om values suchte in scientific no

ctly be interpretpped

antees how themeter “format:”om format whitor is specifiedr, the value is zdestination, thi

Excel format tha

hen exporting omat for numbers

. Even if you sxpect when the

h as account nu

otation ted as a numbe

output will loo within the TAGich uses the # and the digit is

zero filled if theis will use Exceat you can use

output to Excels when no specspecify a SAS fe general forma

Appearanumbers 01234 Jan 1 12345

er 00E1 2,365

k in Excel. YoGATTR= attribuand 0 as it’s d

s missing or ise value is not prel’s default formwithin your SA

. You will wancific Excel formformat, Excel tat is triggered.

nce in SAS 45

56789101 70 5

u can apply anute. You can s

digit selectors azero, the digit resent. If you umat.. Also not

AS jobs.

nt to be aware omat is applied. T

triggers the ge

Excel 12345 1/1 1234567E+11Invalid Numbe 2365

n Excel format wspecify an Exceand acts as a is not displayeduse a style suce that the Exce

10

of how This neral

er

with el

d. ch as elXP

Page 11: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

11

Excel Formats (ExcelXP) Format Format String SAS Format Original Value Value After Format General General BEST. 012345678 12345678 General Number Number BEST12.2 012345678 12345678.00 Currency Currency DOLLAR12.2 12345678 $12,345,678.00 Euro Currency Euro Currency 12345678 € 12,345,678.00 Accounting Accounting DOLLAR12.2 12345678 $12,345,678.00 General Date Date E8601DT ‘14Jun30:00:00”DT 14/06/30 0:00 Short Date Short Date ” “ 18618 12/21/1950 Long Date Long Date “ “ 18618 Saturday, June 14, 1930 Short Time Time HH:MM ‘14Jun30:09:30”DT 9:30 Percentage Percentage PERCENT. 12 1200.00% Scientific Scientific Ew.d 1.2345678 1.23E+07 Text Text CHAR. 012345678 012345678 Yes/No Yes/No 1 Yes Custom @ $w. 012345678 012345678 Custom ######### BEST. 12345678 12345678

Fixed Fixed $w.2 12345678 12345678.00

Custom 0000 w.d 00001234 00001234 Custom #,##0 COMMAw.d 1234 1,234 Custom #,##0.00 COMMAw.d 1234 1234.00 Custom #,##0_);(#,##0) NEGPARENw.d -12345 (1,2345) Custom #,##0_);[Red](#,##0) NEGPARENw.d -12345 (1,2345) Custom #,##0.00_);(#,##0.00) NEGPARENw.d -12345 (1,2345.00) Custom #,##0.00_);[Red](#,##0.00) NEGPARENw.d -12345 (1,2345) Custom $#,##0_);($#,##0) DOLLARw.d -12345 ($1,2345) Custom ($#,##0.00_);($#,##0.00) DOLLARw.d 1234567 $1.234,567.00 Custom ($#,##0.00_);[Red]($#,##0.00) DOLLARw.d 1234567 ($1234,567.00) Custom _($*#,##0_);_($*(#,##0);_($*"-"_);_(@_) DOLLARw.d -12345678 $*******$(1,234,567) Custom 0% PERCENTw.d 12 1200% Custom 0.00% PERCENTw.d 12 1200.00 Custom 0\% PERCENTw.d 12 12% Figure 9. CUSTOM FORMAT OPERATORS There are various needs for the custom formats. For example there are times when I would like to show the percentage value as it is currently without having it multiplied by 100 before displaying the value. In this case I could use the escape character “#\%” to simply show the % which is different than the percent format or the $% which both multiply the result by 100 before displaying the value. Using the escape operator will allow us to apply text the % as a character as we could any other character. There are other times when I want to justify values on the decimal which I can do using the ? operator. We can also display the text as it s using the @ operator. Below is a table which list the operators, the description and an example of how this would be applied. These characters will allow you to do quite a bit of customized formatting in Excel. Excel Format Characters Character Description Example 0 (zero) Pads the value with zeros 00000 displays a five digit

number packing it with leading zeroes if needed. For example the value 2. displays as 00002.

# Does not display extra zeros. #.### displays three significant digits after the decimal and one digit prior. For example the number 1234 displays as 1,234

? Leaves a space for insignificant zeros but does not display them.

#???? retains space or decimal allows alignment.

. (period) Displays decimal number. ###.## displays two significant digits on the right side of the decimal

% Displays value as a percentage and multiplies ##% displays the number

Page 12: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

12

by 100 multiplied by 100 and with a percent sign.. The number 5 is displayed as 500%

, (comma) A comma followed by a placeholder scales the number by a thousand

#,### thousands separator . For example the number 1234 is displayed as 1,234

Text Code Description \character This code displays the character you specify #,###\M displays the character

following with an M. For example the value 1234 is displayed as 1,234M.

"text" Displays the value as text. 01234 displays as is * Repeats a character to fill the format *x fill cells with the character x.

_ (underscore) Skips the width of the next character _) enters the space the width of a closing paren

@ Text placeholder. 01234 displays as-is Date Code Description m Month as a number without leading zeros (1-12) 4 mm Month as a number with leading zeros (01-12) 04 mmm Month as an abbreviation (Jan - Dec) Jan mmmm Unabbreviated Month (January - December) February d Day without leading zeros (1-31) 6 dd Day with leading zeros (01-31) 06 ddd Week day as an abbreviation (Sun - Sat) Mon dddd Unabbreviated week day (Sunday - Saturday) Monday yy Year as a two-digit number (for example, 96) 10 yyyy Year as a four-digit number (for example, 1996) 2010 Time Code Description h Hours as a number without leading zeros (0-23) 22 hh Hours as a number with leading zeros (00-23) 00-22 m Minutes as a number without leading zeros (0-

59) 58

mm Minutes as a number with leading zeros (00-59) 00-58 s Seconds as a number without leading zeros (0-

59) 21

ss Seconds as a number with leading zeros (00-59)

00-21

AM/PM am/pm Time based on the twelve-hour clock 12:00AM Miscellaneous Code Description [BLACK], [BLUE], [CYAN], [GREEN], [MAGENTA], [RED], [WHITE], [YELLOW], [COLOR n]

Display the characters in the specified colors. n is a value from 1 to 56 .

[green]#,### displays 1234 as 1,234

Figure 10. ANATOMY OF CUSTOM FORMATS Every custom format is made up of four sections. These are the formats for positive value, negative value, zero values and text. If only one section is specified, then this is what is used. We do however, have the ability to control these values individually. In the example below we add a format with the thousands separator for the positive value, the negative value in red with paren’s, zero values with two decimal places and the text format for text., The first section and the most popular is section. If only section one is specified, then this is used in all cases.

We also have the ability to set up a maximum of 4 expressions within this custom format. For instance for expression one, we can set the format for values greater than 900 to be red and use the # digit selector. The next expression

Page 13: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

13

looks for values greater than 500 and less than 900 which colors this blue and uses a # digit selector. Other numeric’s up to 500 use the # digit selector and is green. The third expression will not allow you to specify condition, only a format. Finally all of the text values are Cyan. The colors can also be expressed as 1-56.

APPLYING EXCEL NUMBER FORMATS Applying an Excel number format is needed to guarantee how a value appears in Excel. This number format is specified differently depending on the ODS Destination. Beginning with version 1.28 of the ExcelXP tagset the “format : “parameter was added as a valid value to TAGATTR= attribute. This allows you to pass various arguments such as the formulas, hidden columns, rotated headers and the number format. The ability to apply the number format as mentioned is added by using the TAGATTR= attribute with the Format: parameter. Note this is case sensitive. The Date Type can be specified also by using the Type parameter. If you do not explicitly set the data type, it will be set by the ExcelXP tagset. The ExcelXP tagset has an elaborate pattern matching routine which regardless of the data type in SAS uses the PRX functions to determine whether this value is either a “String” or “Numeric”. If you want to override this process then you have the ability to manually do so. The MSOffice2K and the HTML destinations implement this differently using Microsoft Office specific CSS style sheet property which is the mso-number-format . Destination Attribute Parameter Excel Verison ExcelXP TAGATTR= format: Excel 2002 + MSOffice2k / HTML

HTMLSTYLE= mso-number-format

Excel 2000 +

HTML3 HTMLSTYLE/ HTMLCLASS

mso-number-format

Excel 97+

CSV See Example Figure 11. Table of ODS and attributes used for formatting With the ExcelXP tagset, we can pass the Excel number format using the TAGATTR= attribute. We can also modify the data type for instance changing the type from a Number to a String using the TagAttr= attribute as well. The three statements below would be similar for displaying a numeric which preserves a leading zero.. var a / style(data)={tagattr="type:String"}; var a / style(data)={tagattr="format:@"}; var a / style(data)={tagattr="format:Text"}; Figure 9 below describes the methods used to pass the number formats to the various destinations. The example below demonstrates the use of number formats specified with the ExcelXP destination and the various other ODS destinations used to export data to Excel. Also, the example demonstrates the use of the text format to retain the leading zero from variable Leading, a custom format to retain the trailing 0 for variable trailing, the text format to prevent variable scientific from being displayed in scientific notation . condition which applies conditional formatting, repeat which repeats a fill character for the cell, thousand which adds a thousands separator ,and label which allows text to be appended . data one; input leading trailing scientific $18. condition repeat thousands label; cards; 0001 12345.10 123456789101112145 100 200 1000 1.2 0002 23455.20 333434455555544334 200 300 2000 1.46 0003 12344.10 123456789101112145 300 400 3000 1.2 0004 23452.20 333434455555544335 400 500 4000 1.46 0005 12346.10 123456789101112146 500 600 5000 1.2 0006 23459.20 333434455555544338 600 700 6000 1.46

Page 14: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

14

; run; ods tagsets.excelxp file="temp.xls" style=styles.solutions; proc print data=one; format leading z4.; var leading / style(data)={tagattr="format:@"}; var trailing / style(data)={tagattr="format:#####.#0"}; var scientific / style(data)={tagattr="type:String"}; var condition / style(data)={tagattr="format:[green][>400];[yellow][>200]#,###;[red]#,###"}; var repeat / style(data)={tagattr="format:$**#,###"}; var thousands / style(data)={tagattr="format:#,###"}; var label / style(data)={ tagattr='format:#.##\m'}; run; ods tagsets.excelxp close;

Figure 12. Output after

l Figure 13. Output before formatting ading EXCEL DATES When formatting dates in output generated with the ExcelXP tagset, it is important to note that Microsoft Excel stores dates in datetime format. If the dates are not in ISO datetime format, the value will not be

Missing zero Missing Trailing zero

Data displayed in scientific notation

Thousands separator removed

Page 15: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

15

treated as a true Excel date. SAS date values must first be converted to datetime format using either the IS8601DT. format in SAS® 9.1.3 or the E8601DT. format beginning in SAS® 9.2. The data type can be modified and passed to Microsoft Excel using TAGATTR= attribute. This attribute can be used to pass both the TYPE= parameter, which can be used to modify the data type, and the FORMAT= parameter to modify the displayed format.. Variable Date1 muultoplies the value by 86400 to create the date time value and variable newdate use the DHMS function to create the date time value. The format is specified with the TAGATTR= attribute along with the format parameter. data test; date= date()*86400; newdate=dhms(date(),0,0,0); format date newdate e8601DT.; run; ods tagsets.excelxp file="c:\temp\temp.xls" options(embedded_titles= 'yes'); proc print data=test; var date / style(data)={tagattr='type:DateTime format:mm/dd/yy;@'}; var date / style(data)={tagattr='type:DateTime format:yyyy-mmm-dd;@'}; title "Modifying the data type and format of a date value"; format date newdate e8601DT.; run; ods tagsets.excelxp close; FORMULAS AND FUNCTIONS One of the most powerful tools when it comes to using Excel is the ability to use formulas. This separates the static HTML page from a worksheet. Having the ability to generate formulas allows you to add information that is based on other cells or a computation of the same cell. Having this ability also allows you to leverage the power of both Excel and SAS. Formulas are added with the ExcelXP tagset using the TAGATTR= attribute with the "Formula:" parameter much the same way we did with the formats as you saw in an earlier section. Formulas in Excel are expresses using two separate methods. The first method is using the A1 notation and second method is the R1C1 notation. The ExcelXP tagset supports formulas using only the R1C1 notation in a formula. The conversion between the two methods is pretty straight forward. When using the A1 notation, this is the same as specifying the formula as R1C1 (Row 1 Column 1). The A1 notation can use both absolute and relative formulas, however, the relative formulas are used most often. Take a look at the table below with the conversion between formulas using the A1 reference and the R1C1 Notation.

Figure 14. Formula representation

A1 Notation R1C1 Notation A1 R1C1 (Row 1 Column 1) A2 R2C1 (Row 2 Column 1) B1 R1C2 (Row 1 Column 2) C1 R1C3 (Row 1 Column 2) B2 R2C2 (Row 2 Column 2) A1+1 RC1+1 (Current Row Column 2)

Page 16: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

16

Excel Statistical/Math Functions Purpose SUM total numbers in range AVERAGE generates an average over the range COUNT/COUNTIF frequency or count of cells/ conditional count MEDIAN reports the median or the value in the middle MAX reports the highest value in the range MIN reports the lowest number in the range MODE the value that occurs most often SUM/SUMIF total over the range/ total based on a condition INT extract only integer portion MOD divider with a remainder ROUND/ROUNDUP round the number up/ round the number down Text Function CLEAN strips all non printable or special characters CONCATENATE joins or combines the values of one or more cells or

strings TEXT converts output to text TRIM removes spaces REPT repeats value specified number of times CODE character code Figure 15. Common Excel Functions Relative references can be expressed as R[-18]C + R[-1]C which would add the value 18 rows prior in the current cell to a value one row in the previous within the same cell. The formula expressed R[-5]C[-3] would be 5 rows prior and 3 columns to the left. When the brackets are omitted, it is the same row and same column. Functions can be added within this "formula:" parameter. The below example uses the Concatenate function, MIN, MAX, Average and SUM functions with a computed column within PROC REPORT. Functions can also be nested, however, there is a limitation of 7 deep. Listed below are some of the commonly used statistical and text functions and how they can be used. options missing="0"; ods tagsets.excelxp file="temp5.xls" style=solutions; proc report data=sashelp.prdsale(obs=100) nowd; column year product actual predict concat sum average max; define concat / computed style(column)={tagattr='formula:=concatenate(RC[-4]," ",RC[-3])' }; define sum / computed style(column)={tagattr='formula:=sum(RC[-3]-RC[-2])'}; define average / computed style(column)={tagattr='formula:=average(RC[-4],RC[-3])'}; define max / computed style(column)={tagattr='formula:=max(RC[-5],RC[-4])'}; run; ods tagsets.excelxp close;

Page 17: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

17

Figure 16. Output with functions and formulas applied FORMULAS AND STYLES You can also use formulas to generate styles. For instance, you can use the MOD(ROW,2) and MOD(COLUMN,2) functions similar to the same way you can in SAS to create alternate row and column colors fonts or other style information. This is done by adding the <ConditionalFormating> tag. This can also be extended to include traffic lighting based on a value. Take a look how this has been added and how easy it is. I have added options to the tagset which can be downloaded from the zip file below. The alternate row background and foreground colors can be specified along with the alternate column colors ftp.sas.com/techsup/download/base/sgf34.zip ods tagsets.excelxp_mod file="temp7.xls" options(fbanner_color_even="red" banner_color_even="lightblue" fbanner_color_odd="black" banner_color_odd="yellow") style=sasweb; proc print data=sashelp.class; run; ods tagsets.excelxp_mod close;

Figure 17.

Page 18: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

18

EXCELXP TAGSET OPTIONS One of the most powerful aspects of the ExcelXP destination is the ability to create and use options which allow you to drive the Excel worksheet. The options parameter was introduced to the ODS Markup family in release SAS 9.1.3. If you try using the options parameter prior to this release, a syntax error is generated. If you are using a version prior to SAS 9.1.3, you can still take advantage of the default multiple worksheet per workbooks as well as using macro variables which allow you to do perform some of the commonly used tasks which will be demonstrated in a section later. We will discuss some of the options and the functionality of those options. DOCUMENTATION OPTIONS The ExcelXP tagset has many options which you can list in the log by using the options Doc=”help” for detailed help including the syntax used for the options. The DOC=”Quick” option can be used to list simply the available options and a short description of the option. There is also a change log that shows the enhancements and the fixes of the ExcelXP tagset based on the version of the tagset. This allows you to decide whether you want to upgrade the tagset based on the functionality added.

1. ods tagsets.excelxp file=”temp.xml” options(doc=”help”);

2. ods tagsets.excelxp options(doc='Quick'); You can also create an HTML file with all of the options using the FRAME= option with the path and the name of the file that you want to create and this can be stored and viewed at a later time. This file generated will also contain the change log as mentioned earlier. To create this file with the valid options, see the example below. Ods tagsets.excelxp file=”temp.xml” options(frame=”c:\options.html”); TITLE AND FOOTNOTE OPTIONS Titles and footnotes are not included in the worksheet by default. They are added to the header and footer sections of the worksheet and displayed when the worksheet is printed or previewed. To add the titles and footnotes to the worksheets, use the EMBEDDED_TITLES="yes" option for the titles and the EMBEDDED_ FOOTNOTES =”yes” for the footnotes. If you use these options to add titles and footnotes within the worksheet and you want different information in the header and footer sections, use the PRINT_HEADER= and the PRINT_FOOTER= options to specify the headers and footers. You can also specify the EMBEDDED_ TITLES_ ONCE= option which allows you to specify the title once on the worksheet. The below example demonstrates how the titles are and headers and footers are displayed with these options. The below example adds an embedded titles which is the default title and a header which is the PageOF information and a footer which is the date. There are various header and footer codes which you can find at the following location http://support.sas.com/kb/39/112.html Beginning with tagset V1.116, there are some new options available which provide the ability to merge the titles and and footnotes across the table. Currently, if you have a long title or footnote that extends beyond the width of the table, part of the output is hidden. The MERGE_TITLES_FOOOTNOTES= option and the TITLE_FOOTNOTE_ WIDTH= options were added and will provide a solution to the previous issue. As a default, the left justified titles and footnotes do not use the wraptext or the mergeacross. Centered titles do MERGE_TITLES_ FOOTNOTES=yes causes all titles to use wraptext and mergeacross title_footnote_width is the number of columns that should be used when using merge across. ods tagsets.excelxp file="temp.xls" options(embedded_titles="yes" embedded_footnotes="yes" print_header='&rPage &p of &P' print_footer='&r Date &D') style=solutions; proc print data=sashelp.class; run; ods tagsets.excelxp close;

Page 19: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

19

Figure 18. Embedded titles with printed header and footer PAGE SETUP OPTIONS The largest group of options affect the page setup area which are documented in this section. The worksheet orientation can be modified using the ORIENTATION= option. The PRINT_HEADER= and the PRINT_FOOTER= option can be added to specify text to the header and footer sections. You can select rows to repeat when the page is printed by using the ROW_REPEAT= option with the row to repeat. When the output goes across multiple pages, it is usually desired to have the headers repeat. The printed output can be scaled by using the SCALE= option. The PAGES_FITHEIGHT= and the PAGES_FITWIDTH= options can be used to modify the pages to fit the width and height of the page. The paper size is modified by using the system option PAPERSIZE= on the SAS options statement. The Vertical and horizontal justifications can be specified using the CENTER_VERTICAL= and CENTER_HORIZONTAL= options. The DPI can be modified using the DPI= option. The PAGE_ORDER_ACROSS= option can be specified to control the direction of the output. The margins can be set using the LEFTMARGIN=, RIGHTMARGIN=, BOTTOMMARGIN= and the TOPMARGIN= system options. The below example uses some of the below options. Options topmargin=.25 bottommargin=.25 leftmargin=.25 papersize=legal; Ods tagsets.excelxp file=”temp.xls” options(Orientation=”landscape” Print_Header=”&rPage &P of &T” Print_Footer=”&LThis is Scale=”90” FittoPage=”yes” Row_Repeat=”yes” DPI=”200” Center_Vertical=”yes”); Proc print data=sashelp.class; Run; Ods tagsets.excelxp close; DISPLAY OPTIONS The display options reflect the way that the data is presented on this worksheet. It helps the consumer of the worksheet navigate and read with ease. Some of these options include the FROZEN_HEADERS= and the FROZEN_ROWHEADERS= options which allow you to freeze the rows and the columns. Drop-downs or filters can be added using the AUTOFILTER= option. The output can be zoomed using the ZOOM= option. The below example demonstrates the use of these options. If you are using the tagset version 1.116, then you can also use the

Page 20: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

20

WRAPTEXT= option which will set the defaults to yes as the default wrap text behavior. If you are using versions of the ExcelXP tagset between 1.70 and 1.94, then to have text wrap, you will need to specify a combination of the AUTO_HEIGHTS= option with value of yes, along with the ABSOLUTE_COLUMN_WIDTH= option which will wrap text when column width is reached. Ods tagsets.excelxp file=”temp.xls” options(frozen_rowheaders=”2” Frozen_headers=”yes” Autofilter=”yes” Zoom=”80”); Proc print data=sashelp.class; Run; Ods tagsets.excelxp close;

Figure 19.

TEXT WRAP OPTIONS Text wrapping happens by default when generating HTML based output which is created by destinations such as MSOffice2k and HTML3. However, this is not the default with the ExcelXP destination. The effect of this is that the full text of a cell may not display within the worksheet . If you click on the cell, you can see the full value within the tool bar. Beginning with Version 1.116 of the ExcelXP tagset, you can use the WRAPTEXT= option to set this default. Prior to this, if you have a version greater than 1.28 of the ExcelXP tagset you can use a combination of the ABSOLUTE_COLUMN_WIDTH= option and the AUTOFIT_HEIGHTS= option. Using this method , once the width is reached for the cell the text automatically wraps. Using the first example below, you can see that the output does not wrap and only displays a portion of the contents of the cell for columns X and Y. The second example uses the ABSOLUTE_COLUMN_WIDTH= option along with the AUTOFIT_HEIGHT= option. Once the cell width is reached, the row height is increased to fit the width of the cell. data one; x="this is a long variable that spans"; y="this is another long value "; run; Ods tagsets.ExcelXP file="temp9.xls" options(absolute_column_width="6,6" autofit_height="yes"); proc print data=one; run; Ods tagsets.excelxp close;

Figure 20. Output not wrapped Figure 21. Output wrapped

Frozen headers Filters

Page 21: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

21

NAMING WORKSHEETS The ExcelXP destination generates a separate worksheet for each procedure or DATA Step as a default which is very powerful and unique. The worksheet names can be modified by using the SHEET_NAME= option. To change the label portion of the default sheet name, the SHEET_LABEL= option can be specified. If these options are not used, the worksheet is named using a default naming convention. By default the sheet names are named using the form: “Table 1+ “Object Label”. The object label is generated based on the procedure. The index number of the table is incremented for each worksheet added. In addition to the SHEET_NAME= and the SHEET_LABEL= options, the SHEET_INTERVAL= option controls the behavior of the worksheet along with how this sheet will be named. The valid values for the SHEET_INTERVAL= options are Bygroup, Table, Proc, Page and None. The default value for the SHEET_INTERVAL= option is Table. When this value is changed to Bygroup, each of the bygroups are added as separate worksheet and the by-group name is added along with the value to name the worksheet. The by-group name which prefixes the label can be modified using the SHEET_LABEL= option. When the value Proc is used, the sheet is prefixed with the name “PROC” with the index of the procedure. This is similar when the SHEET_INTERVAL= page. Sheet_Interval= option

Behavior Default Sheet name

Table (default) Generates separate worksheet for each table created

“Table” (Number of worksheet) - Label Ex. Table 1 - Data Set SASHELP.CLASS

Bygroup Generates a separate worksheet for each by group

Bygroup name=Bygroup value Ex. Age=11

Page Generates a separate worksheet for each page

Page= (Number of worksheet) -Label Ex. Page=1 PRINT

None Places output on the same worksheet

Sheet_interval will default to Table unless the SHEET_NAME= option is specified.

Proc Generates output based on the proc

Proc (Number of worksheet) Ex. Proc 1

Figure 22. Sheet interval description Ods tagsets.ExcelXP file=”temp.xml” options(sheet_name=”First Sheet”); Proc print data=sashelp.class(obs=5); Run; Ods tagsets.Excelxp options(sheet_name=”Second Sheet”); Proc print data=sashelp.class(obs=5); Run; Ods tagsets.excelxp close;

Figure 23.

Page 22: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

22

ADDING MULTIPLE OUTPUTS ON A SHEET The default for each piece of output is to add as a separate sheet in the current workbook. However, there are times that you want to add multiple procedures on a worksheet and then go to the next worksheet and continue writing output. You can do this by modifying the parameters of the SHEET_INTERVAL= option. The option SHEET_INTERVAL=”none” is added to turn off the default behavior of adding the output on a new worksheet. The SHEET_INTERVAL= “Table” is then added to begin writing to the next worksheet. Ods tagsets.excelxp file=”c:\temp\temp.xls”; Ods tagsets.excelxp options(sheet_interval=”none” Proc print data=sashelp.class; Run; Proc print data=sashelp.class; Run; Ods tagsets.excelxp options(sheet_interval=”table”; Ods tagsets.excelxp options(sheet_interval=”none”; Proc print data=sashelp.orsales(obs=50); Run; Proc print data=sashelp.class(obs=50);; Run; Ods tagsets.excelxp close;

Figure 24. SPACES HANDLING The SKIP_SPACE= option controls how much space is added within the various sections of the worksheet. You might have a request to remove spaces between the title and the table. In this instance, the fourth parameter in the SKIP_SPACE= option can be modified to change the default space between the title and the table. Likewise, if we want to prevent the space between the footnote and the tables, the fifth parameter can be modified and changed to prevent the space. We can also modify the other various parts of the output which are listed below. The parameters are positional and must be specified in this order. (Table_head,Table,Byline,Title,Footer,PageBreak,Parskip) Ods tagsets.excelxp file=”temp.xml” options(embedded_titles=”yes” skip_space=”0,0,0,1,1,0,0”) style=style.normal; Proc print data=sashelp.class; Run; Ods tagsets.excelxp close;

Page 23: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

23

Figure 25 Removing spaces after the table and the title

NAVIGATING WORKSHEETS A table of contents can be generated which creates a separate worksheet that is simply a navigational aid to the rest of the worksheets in the workbook. This is added using the option CONTENTS= “yes” . Just as the table of contents created by other destinations such as HTML and PDF, the ODS PROCLABEL statement can be used to modify the procedure names in the table of contents. The CONTENTS= option can be used to rename the sub-nodes within the table of contents. Procedures that support the CONTENTS= are the PRINT, REPORT, TABULATE and FREQ procedures.. When the INDEX= option is specified, it also creates a navigational aid to the worksheets, however, as you will see that the output is structured quite a bit differently then when the CONTENTS= is used. The INDEX= option basically list the worksheets and gives a numerical order of the worksheets . You can say this is a shorter version, while still very effective. To use this feature, the version of the tagset will need to be at least version 1.86 of the ExcelXP tagset installed. Below is an example using both options. Ex. 14 ods tagsets.excelxp file="temp.xls" options(contents="yes" index="yes") style=sasweb; proc print data=sashelp.class; run; proc print data=sashelp.class; run; proc univariate data=sashelp.class; run; proc freq data=sashelp.class; run; ods tagsets.excelxp close;

Page 24: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

24

Figure 26. Table of Contents created Figure 27. Output using the INDEX= option CONFIGURATION OPTIONS There are other options such as the CONFIGURATION_FILE= option which allows you to store commonly used options in a file rather than having to include an expanded list of options in the program. SAS 9.1.3SP4 currently has a limit on the number of options that can be added in-line within the program. This is one way around the limitation. This option can also reduce the in-line code by simply adding the configuration file which we simply refer to with options. A configuration file can be generated with the default options which you can add to or subtract from. To create this configuration file, use the DATA= option. This will create a configuration file with default options that are supplied. You can use this as a sample or template to add or remove options. There is also the CONFIGURATION_NAME= option which allows you to specify by name which part of the configuration file to use. The below step uses the configuration file created. Ods tagsets.excelxp file=”c:\temp.xml” /* data=”c:\temp.ini” */ options(orientation=”landscape” zoom=”80” configuration_file=”c:\temp.ini”); proc print data=sashelp.class; run; Ods tagsets.excelxp close;

USING EXCELXP WITHOUT OPTIONS If you are using the ExcelXP destination without options, you are simply taking advantage of the multiple worksheets per workbook. However, you are really missing out on some of the unique features of the options ODS Markup option which allows you to drive this entire workbook and the worksheets. If you are using SAS prior to SAS 9.1.3, you will not have the options parameter available to you. Depending on the version of the tagset that you have installed, you will have defined macro variables you which you can use rather than the options. The MVAR statement in the tagset defines all of the macro variables available to the tagset. Below is a list of some of the macro variables which are set in the ExcelXP tagset at release 1.86. The macro variables are initialized here and applied by passing a value to these macro variables at execution time. The below example demonstrates the use of these macro variables.

Page 25: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

25

The MVAR statement below is taken out of the tagset. mvar embedded_titles embedded_footers frozen_headers frozen_rowheaders autofilter width_points width_fudge default_column_width formulas convert_percentages orientation override_sheetname; %let embedded_titles=yes; %let frozen_headers=yes; %let orientation=landscape %let override_shee_name=some_sheetname; Ods tagsets.excelxp file=”temp.xls”; proc print data=sashelp.class; run; Ods tagsets.excelxp close;

MSOFFICE2K DESTINATION The MSOffice2K destination generates HTML which is generated specifically for Microsoft Office products. Unlike the ExcelXP tagset, the MSOffice2k destination can include graphics and tables. This format can be enhanced using HTML tagging, CSS, which includes the Microsoft specific CSS style properties , PROC TEMPLATE and in-line formatting. Unlike the ExcelXP destination, the MSOffice2k destination does not have options defined by default. One of the benefits of the ODS Markup language is that we can add options. The MSOffice2K destination is a quick and easy method of generating Excel output without having to worry about the release of Excel. If you have a version of Excel prior to Excel 2002, this is the destination of choice when exporting to Excel. We will discuss some features regarding modifying styles, cell formatting, page setup and adding options to your MSOffice2K tagset. STYLES We can enhance output of the MSOffice2K destination using PROC TEMPLATE, In-line formatting and CSS including the Microsoft Office specific style sheet properties. This can be presentation such as modifying the colors , fonts and borders; adding images; rotating headers; and improving the overall presentation of the output., This also includes such things as preventing text from wrapping in a cell to cells from going to multiple rows. We can do it all with the MSOffice2K destination. Unlike the ExcelXP destination, we can combine graphics and tables. We will use a combination of methods to modify the style or presentation. One of the great benefits of using this destination is that you can use the HTMLSTYLE= attribute to pass any CSS style attribute. Below are a few style changes. ROTATE HEADER The below example uses PROC TEMPLATE to define a style that uses the HTMLSTYLE= attribute within the Header style element with the Microsoft Office specific style sheet property mso-rotate. The argument specifies that the header be rotated 45 degrees and the CSS style properties height and vertical-align to add a rotated header along with the row height and vertical justification for the column headers. proc template; define style styles.test; parent=styles.meadow; style header from header / htmlstyle="mso-rotate:45; height:70; vertical- align:bottom"; end; run; ods msoffice2k file="temp1.xls" style=styles.test ; Proc report data=sashelp.prdsale nowd; title; Run; Ods msoffice2k close;

Page 26: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

26

Figure 28. Vertical headers GRIDLINES AND BORDERS You can modify the border properties modifying such things such as the width, color, and style. The example below uses the BORDERWIDTH=, BORDERLEFTCOLOR=, BORDERRIGHTCOLOR=and the HTMLSTYLE= which passes the CSS style property for the border style. Ods msoffice2k file="temp1.xls" style=sasweb; Proc report data=sashelp.class(obs=5) nowd; define age / style(column)={borderwidth=5 borderleftcolor=red borderrightcolor=blue htmlstyle="border-style:dashed"}; title "Modify border style and color"; run; Ods msoffice2k close;

Figure 29.

Page 27: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

27

MSOFFICE2K-PAGE SETUP Modifying some of the page setup information can be done using the Microsoft specific style sheet properties. The header and footer information, margins, page number and some other properties can be added using the CSS style properties. Some other information such as the sheet orientation is done with XML in the header of the file . The example below modifies page setup information using the Microsoft Specific CSS information. This information is added using the HEADTEXT= option on the ODS statement which adds the <head> </head> section of the HTML file. This information is added within the CSS @Page rule. Ods msoffice2k file="temp.xls" headtext='<style> @Page {mso-header-data:"Page &p of &P"; mso-footer-data:"&r Date &D"; mso-page-number:1; mso-header-margin:.5; mso-footer-margin:.5; margin-left:.2in}</style>'; proc print data=sashelp.class; run; ods msoffice2k close; MSOFFICE2K - CELL FORMATTING We discussed cell formatting in detail with the ExcelXP destination in an earlier section. In this section, we will briefly discuss how number formats can be added using the with the MSOffice2K destination. Number formats can be modified using the mso-number-format CSS style property with the MSOffice2K and the HTML destinations. As mentioned earlier with the ExcelXP destination, when data is exported into Excel without an explicit format, the General format is used by Excel. This can cause such issues as leading zeroes omitted, negative dollar formats displayed as text, long values displayed in scientific notation, and the decimal places not displaying as expected. The below example applies a custom format for variables keeping the loading zeroes, adding a custom format for the negative numbers which are displayed in red, the currency format is added and finally the text format for long numbers. Excel can only display 15 digits significantly, therefore, the text format is added for the variable long. data one; input leading negative currency long $17.; cards; 012345 -34567 4566663 2033636643662621 052345 -68767 1235577 2347474737272737 072345 76684 8787878 1249395500606060 002345 67676 5657775 4588383888848388 ; run; ods msoffice2k file="temp2.xls" stye=meadow; proc print data=one; format leading z6.; var leading / style(data)={htmlstyle="mso-number-format:\@"}; var negative / style(data)={htmlstyle="mso-number-format:'#,##0_);[Red](#,##0)'"}; var currency / style(data)={htmlstyle="mso-number-format:currency"}; var long / style(data)={htmlstyle="mso-number-format:\@"}; run; ods msoffice2k close;

Page 28: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

28

Figure 30. Cell Formatting MODIFYING MSOFFICE2K The MSOffice2K destination does not have options defined by default like the Tagsets.ExcelXP. Because all tagsets now have the ability to add options, opt ions can be added to the MSOffice2K destination to emulate the ExcelXP destination. This section describes how options are added and used with the MSOffice2K destination. The HTML and CSS can be modified based on the options passed to generate the desired behavior. The modified MSOffice2K destination can include images and can be used with any version of Excel. This new destination allows you to modify the orientation, sheet names, scaling, zooms, page setup information and more. We will discuss how options are added and the usage. ADDING AN EXCEL NAMESPACE Before adding some options to the MSOffice2K tagset, we first want to add an Excel name space to the beginning HTML tag. Once the namespace is added, quite a bit of functionality can be added. Some of the functionality added requires a reference to the namespace alias before generating the desired effect. To add the namespace either to a modified version of the MSOffice2K destination the DOC event can be modified such as the below. Once this name space alias is added, quite a bit of functionally can be added such as adding formulas, filter, modified data types ad quite a bit more. You can find everything possible with the download listed in the resources. define event doc; start: put '<html xmlns:x="urn:schemas-microsoft-com:office:excel">' NL; finish: put "</html>" NL; end; After adding the namespace above using PROC TEMPLATE modifying the MSOffice2K tagset, we can then refer to the namespace alias to set the data type for a column. For the variable age, the data type was modified from the default numeric to String. This would have the same effect of adding the text format without adding the green diamonds indicating that we are formatting a numeric with the text format. We can also set the filter for the column headers. Finally, Also, formulas can be added to a column without using a styles. proc template; define tagset tagsets.test; parent=tagsets.MSOffice2K; define event doc; start: put '<html xmlns:x="urn:schemas-microsoft-com:office:excel">' NL; finish: put "</html>" NL; end; end; run; title; ods markup file="c:\temp\temp.xls" tagset=tagsets.test style=meadow; proc report data=sashelp.class nowd style(header)={tagattr='x:autofilter="all"'};

Page 29: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

29

col name sex age height weight total; define age / style(column)={tagattr="x:str"}; define total / style(column)={background=yellow}; compute total; count+1; if count=1 then count+1; range1='d'||left(count); range2='e'||left(count); call define(_col_,"style","style={tagattr=' x:fmla=''sum("||trim(range1)||','||trim(range2)||")'''}"); endcomp; run; ods markup close;

Figure 33. Output using the X alias MSOFFICE2K TAGSET WITH OPTIONS Referenced below is a link to the sample MSOffice2K_X tagset that is simply the MSOffice2K destination with options added. This tagset is not installed by default with the SAS installation, you will have to download this tagset from the URL listed below. Once you download this tagset, to include it, you will have to %INCLUDE the tagset code into the current code, or simply bring the code into the program editor and run it. The compiled tagset MSOffice2K_X is then added to the SASUSER location unless the ODS PATH statement is modified to change the location of where we search. To see all of the options available to the tagset, use the DOC=”help” option on the tagset. As you will see, you can then use options to drive the worksheet much like the ExcelXP destination does as well as you will be able to include graphics.. Below is an example of how to use the tagset. The sample piece of code below demonstrates the use of the options along with the listing all of the options. http://support.sas.com/rnd/base/ods/odsmarkup/msoffice2k/index.html %include “c:\temp\msoffice2k_x.tpl”; ods tagsets.msoffice2k_x file=”c:\temp.xls” options(sheet_name=”test” doc=”help”); proc print data=sashelp.class; run; ods tagsets.msoffice2k_x close; The below example uses the MSOffice2K destination to add display effects such as to freeze the header and row headers, name the sheet, create filter for the column, zoom the output, change the orientation and do other things such as panel the output. These options are applied much the same way as the ExcelXP tagset using the options

Page 30: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

30

parameter. To see the full list of options, use the options DOC=”help”. You will need to be at SAS 9.1.3 to use the options parameter. ods tagsets.msoffice2k_x file="temp2.xls" style=meadow options(sheet_name="test" gridlines="yes" zoom="120" sheet_name="Example" orientation="landscape" panelcols="2" ); goptions vsize=3in hsize=4in; proc print data=sashelp.orsales(obs=5); title; var Year Quarter Product_Line Total_Retail_Price; run; proc print data=sashelp.class(obs=5); run; proc gchart data=sashelp.class; vbar age / frame; run; quit; ods tagsets.msoffice2k_x close;

Figure 34. MSOFFICE2K-MULTIPLE WORSHEETS PER WORKBOOK Creating multiple workbooks per worksheet is best done with the ExcelXP destination. However, this can be done by modifying the MSOffice2K destination or by using the MSOfice2K_X tagset. The requirement for this method is that the files have to be created prior to including it into the workbook as a worksheet. The WORKSHEET_SOURCE= option is used add the files as worksheets within the workbook. If this is prefixed by a “string”# is added as a sheet name. Each file added is separated by a comma. The below example names the worksheet “PRINT” and “GRAPH” and add both the graph and the table as worksheets. If you do not specify the sheet name preceded by the "#", a default naming convention is used which is Table 1, Table 2 /* Create sample data */ Ods Msoffice2k path="c:\temp" file="temp.html" newfile=output;

proc print data=sashelp.class; title;

Page 31: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

31

run; proc gchart data=sashelp.class; vbar age; run; ods msoffice2k close; ods tagsets.msoffice2k_x file="testfile.xls" options(worksheet_source="PRINT#c:\temp\temp.html, GCHART#c:\temp\temp1.html"); Data _null_; File print; Put _all_; Run; Ods tagsets.msoffice2k_x close;

Figure 35.

TABLEEDITOR TAGSET The Tableeditor is a custom tagset that is created by the TEMPLATE procedure. The tableeditor tagset allows you to create effective Web pages as well as files with various format such as a native Excel file. In addition to creating file in various formats such as Excel, it also has the ability to modify Excel file to execute macros, create graphics, add pivot tables, filters and more. This is done by taking advantage of the objects that Microsoft provides. You will see in some of the examples provided later how this tagset can be used to modify and update existing workbooks and worksheets. In the appendix see some of the links pointing to documentation written on this tagset. Below is a simple example of creating an Excel worksheet from an HTML table generated which manipulates this worksheet. Filters are added, the column headers are frozen, multiple sheets are generated, an Excel format is specified, an excel template is used to supply the log, and the file is saved as a native Excel file. You can download this tagset from the below location. http://support.sas.com/rnd/base/ods/odsmarkup/tableeditor/index.html ods tagsets.tableeditor file="%sysfunc(getoption(work))\temp.html" options(excel_zoom="95" excel_scale="90" auto_format="medium1" worksheet_location="3,3" /* worksheet_template="c:\\temp.xltx"*/ excel_frozen_headers="4" excel_save_file="c:\\temp.xls") style=minimal; proc print data=sashelp.class; run; ods tagsets.tableeditor close;

Page 32: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

32

Figure 36. UPDATING WORKBOOKS AND WORKSHEETS There are various methods used to update and manipulate worksheets and workbooks. This is something that is not traditionally done with ODS destinations such as the Excelxp tagset, but can be easily done with PROC EXPORT or DDE. Using the TableEditor tagset, you have the ability to write to an existing .XLS file regardless of the file format. The file could be generated by any of the file formats created with ODS such as the CSV, MSOffice2K, ExcelXP, PROC EXPORT or DDE. The below example generates a file using the ODS Tagsets.ExcelXP destination. This file is then updated to add 3 new tables from the HTML file by specifying the Excel_Table_Move= option with the tables to move. The sheets are named using the Sheet_Name= option with each new table inserted as a new sheet. The files can then be saved in the format of your choice or left in the current format. /* Create Output which is updated */ Ods tagsets.excelxp file=”c:\temp\temp.xls”; Proc print data=sashelp.class; Run; Ods tagsets.excelxp close; /* Update existing Excel output with 3 tables from the web page */ ods tagsets.tableeditor path="c:\temp" file="xxx.html" options(update_target="c:\\temp\\temp.xls" sheet_name="a"); proc print data=sashelp.class; run; ods tagsets.tableeditor options(sheet_name="b"); proc print data=sashelp.air; run; ods tagsets.tableeditor options(sheet_name="c"); proc print data=sashelp.prdsale(obs=100); run; ods tagsets.tableeditor close;

Page 33: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

33

Figure 37. CONCLUSION There are many options to choose from when moving output to Excel. There are many more which we didn’t have the room to discuss here. I have much more information that I would love to share here, but I have to end somewhere. CONTACT INFORMATION Email: [email protected] REFERENCES Parker, Chevell. 2008. “Creating That Perfect Data Grid Using the SAS® Output Delivery System.” Proceedings of the SAS Global Forum 2008 Conference. Cary, NC: SAS Institute Inc. Available at www2.sas.com/proceedings/forum2008/258-2008.pdf. Parker, Chevell. 2007. “Creating a Data Grid Like VB.NET” (includes the TableEditor tagset download). Cary, NC: SAS Institute Inc. Available at support.sas.com/rnd/base/ods/odsmarkup/tableeditor/index.html. SAS Institute Inc. 2008 “ODS MARKUP Resources”. Cary, NC: SAS Institute Inc. Available at support.sas.com/rnd/base/ods/odsmarkup/. SAS Institute Inc. 2006. SAS Note 17890. "An error may occur when there is a long list of options specified for the ODS statement." Cary, NC: SAS Institute Inc. Available at support.sas.com/kb/17/890.html. Parker, Chevell. 2010 “Using ODS Markup to Generate Custom Pivot Tables and Charts” http://support.sas.com/resources/papers/proceedings10/003-2010.pdf 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 trademarks of their respective companies

Page 34: SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institutesupport.sas.com/rnd/base/ods/templateFAQ/office91.pdf · SAS 9.1 MS OFFICE Integration Chevell Parker, SAS Institute

34