Date: Fri, 26 Dec 2003 10:51:08 +0100
Reply-To: Robert Bardos <bardos2@ANSYS.CH>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Robert Bardos <bardos2@ANSYS.CH>
Subject: REPORT: build URL using GROUP and ACROSS variables
Content-Type: text/plain; charset="iso-8859-1"
Gentle SAS-Lers,
(SAS 8.2, Win2k)
I have a seemingly simple task: create a two dimensional HTML table that
allows me to drill down into deeper levels from any cell (be it the
row(group) or column(across) "header" cells, be it the data cells). I come
pretty close building the URL string in a compute block using string
concatenation like e.g.
url="http://tgt.dmn/"||put(year,4.)||put(month,z2.)||".html" where year is
the group variable and month is the across variable. While I get the desired
value for the group variable, I don't get it for the across variable. Having
spent a lot of time searching the archive (through google groups
http://groups.google.com/groups?group=comp.soft-sys.sas which is my
preferred way)and reading the manual I am at the point where a) I ask SAS-L
and b) I go on probably reinventing the wheel using good old macro and 'data
_null_;put' techniques.
As an illustration a piece of code:
<sasl:code>
data abc;
infile cards;
input jahr monat vv @@; /* year month value */
cards;
2003 5 18 2003 6 17 2004 5 25 2004 6 12
; run;
ods listing close;
ods html body="c:\temp\reptest.hmtl";
proc report data=abc nowindows;
column jahr monat;
define jahr / "Year" group;
define monat / "Month" across;
freq vv;
compute monat;
call define(_col_,"style",
"style=[url='http://tgt.dmn/"!!
put(jahr,4.)!!put(monat,z2.)!!".html']");
endcomp;
run;
ods html close;
ods listing;
</sasl:code>
Notes: (1) you may have to change '!!' which is used as the concatenation
operator with my language settings. (2) I realize that I am getting a 'NOTE:
Variable monat is uninitialized.' message. Changing 'put(monat,z2.)' to
'put(monat.n,z2.)' ie. the "variable.statistic" syntax, leads to an 'ERROR:
The variable type of MONAT.N is invalid in this context' which leaves me
rather clueless in this context ...
A picture (monotype font recommended) may help to see what I want:
+------+----+----+ Clicking in the lower right cell should link to
| | 5 | 6 | xttp://tgt.dmn/200406.html
+------+----+----+ (typo intended)
| 2003 | 18 | 17 |
+------+----+----+
| 2004 | 25 | 12 |
+------+----+----+
Any ideas?
Happy Holidays SAS-L!
Robert Bardos
Ansys AG, Switzerland