The SAS Output Delivery System and reporting techniques

Data _null_ excel links

Posts: 21

Data _null_ excel links

Is it possible to create excel workbook that has internal links? This all should be done with tagsets.excelxp and data _null_ as the layout of the document is quite spesific.
Of course it can all be done with proc print or proc report but if data _null_ statement an links was to be used?
Posts: 9,364

Re: Data _null_ excel links

I'm not sure what you mean by "links" or what you mean by using "data _null_ as the layout of the document is quite specific".

About LINKS:
This forum posting shows how to insert hyperlinks to other web sites:

This forum posting discusses how to code "internal" links within the Excel worksheet, as in a Table of Contents, using the CONTENTS= suboption:昕

And this previous forum posting shows how to put a link in a footnote statment:䕄

I'm not sure what other kinds of "links" you mean. You might mean pointing to other columns, as for formulas, but formulas are implemented via the use of the TAGATTR style attribute. If you search the forum, there are many postings about the use of TAGATTR.

About DATA _NULL_:
You said you wanted/needed to use DATA _NULL_ because the layout of the document is quite specific. I believe you may find that "free-format" DATA _NULL_ does not work with ODS in the same way it worked in the LISTING window. So, for example, if you wanted to do something like this:

1) put the first NAME in cell B1 and then put that person's address in C2 and their city/state in C3 and then put their employer in F3
2) put the second NAME in cell B5, address in C6, city/state in C7 and employer in F7
3) put the third NAME in cell B9, address in C10, city/state in C11 and employer in F11
but then after 10 names, switch to a different layout, where you put every name in a different cell with that person's address in the cell directly underneath the name.

The above report would be hard to accomplish. Individual "cells" are not addressable when you use DATA _NULL_ and TAGSETS.EXCELXP. The only way I know to do something as described above is through the use of DATA _NULL_ and DDE -- which is bypassing ODS altogether and is writing directly into a binary Excel worksheet. (Note that I described an arbitrary layout -- your layout is probably more "organized" -- but the important point is that SAS and ODS expect output to be in the form of TABLES -- a very regular arrangement of rows and columns, where every row has the same number of columns and the only row or column spanning that happens will happen in the Headers or RowHeaders of the report table.)

PROC PRINT and PROC REPORT and PROC TABULATE are better tools for creating output for report tables. You can also use DATA _NULL_ for report tables, but, you can only create TABLES when you use DATA _NULL_ and ODS, as currently available. You can't create "free-format" DATA _NULL_ output. The new ODS LAYOUT will allow you more free-format report capabilities for ODS PDF and ODS RTF, and possibly ODS HTML, but I don't know whether ODS LAYOUT type of region control will work with TAGSETS.EXCELXP. And, since ODS LAYOUT is experimental (or pre-production) at this point, the syntax could still change between how it works now and how it will work when the capability becomes production.

If your document/workbook layout is quite specific about print controls, orientation, print headers and footers, etc, then this paper will be of some help in explaining the print controls available to you with TAGSETS.EXCELXP.

For more help in using TAGSETS.EXCELXP to create your output, you might wish to open a track with Tech Support, as they could look at an example of the output you need to create and look at your data and help you figure out the best approach.

Posts: 21

Re: Data _null_ excel links

Posted in reply to Cynthia_sas

Obviously I suffer from baby blues or whatever.. so much has been forgotten.. But at the moment I have following elements on my excel printing:

A Proc Template creating two table templates and conclusion page uses following definitions:

define selite;

ods tagsets.excelxp file='c:\temp\tilaus.xls'
options( embedded_titles='yes' embedded_footnotes='yes' );
%macro printtaa;
%do times = 1 %to &kpl;
%let place=%scan(&names,×,*);
ods tagsets.excelxp options(sheet_name="&place");
and the data _null_ step where all that is calculated before will be put into ods destination. In the data _null_ step there are several set-statements, several merge-statements and other things.

Before defining the table template, a format has to be create for refferring the right sheets on the workbook. Only cntlin can be used, no macro variable references and generating the proc format code.
%do times = 1 %to &kpl;
%let part=%str(%')%scan(&names,×,*)%str(%');
Posts: 9,364

Re: Data _null_ excel links

Ah, I see. If you're using a TABLE template, then you are creating tabular output with DATA _NULL_ and not "free-format" output. Within the limitations of what you can do with the ExcelXP destination, you should be able to get tabular output from DATA _NULL_ into Excel using TAGSETS.EXCELXP.

It looks to me like your macro is building a format for a link, of the form:
wbname.wbext#'Sheet'!Cell" 'LinkText'
--wbname.wbext = the name and ext of the workbook
--Sheet = the sheet name
--Cell = the cell location for the LINK (I usually just code A1 here) and then
--LinkText = the text that the link will display (you may only need this in a title or footnote statement)

For example, in one of the previous forum postings that I referred to, the code is using the Footnote statement to contain a LINK:
footnote link="all_three.xls#'One'!A1" 'Go to One';

which is pointing to all_three.xls workbook, the Sheet named One, the Cell A1. when the user clicks on the text "Go to One", they would get taken to that workbook, that sheet and their cursor will be in that cell.

Your Table template is -NOT- using a Footnote statement, however, your table template is using a URL= style attribute to set the URL for the cell. I'm not sure what your question is. Assuming you have defined the building of the link correctly in your program, your links should work.

If you are having trouble using URL= in your TABLE template with TAGSETS.EXCELXP, your best source of help would be to open a track with Tech Support.

Ask a Question
Discussion stats
  • 3 replies
  • 2 in conversation